Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: mmutex/cmd/mmutex/main.go

Issue 2982763002: Make mmutex actually acquire and release file locks (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mmutex/cmd/mmutex/exclusive_test.go ('k') | mmutex/lib/blocker.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The LUCI Authors. 1 // Copyright 2017 The LUCI Authors.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 package main 15 package main
16 16
17 import ( 17 import (
18 "os" 18 "os"
19 "path"
19 20
20 "github.com/maruel/subcommands" 21 "github.com/maruel/subcommands"
21 ) 22 )
22 23
23 // TODO(charliea): Compute this path from $MMUTEX_LOCK_DIR rather than using a c onstant. 24 // TODO(charliea): Compute this path from $MMUTEX_LOCK_DIR rather than making it fixed.
24 const lockFilePath = "/tmp/lock" 25 var LockFilePath = path.Join(os.TempDir(), "mmutex.lock")
25 26
26 var application = &subcommands.DefaultApplication{ 27 var application = &subcommands.DefaultApplication{
27 Name: "mmutex", 28 Name: "mmutex",
28 Title: `'Maintenance Mutex' - Global mutex to isolate maintenance tasks. 29 Title: `'Maintenance Mutex' - Global mutex to isolate maintenance tasks.
29 30
30 mmutex is a command line tool that helps prevent maintenance tasks from running 31 mmutex is a command line tool that helps prevent maintenance tasks from running
31 during user tasks. The tool does this by way of a global lock file that users 32 during user tasks. The tool does this by way of a global lock file that users
32 must acquire before running their tasks. 33 must acquire before running their tasks.
33 34
34 Clients can use this tool to request that their task be run with one of two 35 Clients can use this tool to request that their task be run with one of two
(...skipping 11 matching lines...) Expand all
46 https://github.com/luci/luci-go/tree/master/mmutex`, 47 https://github.com/luci/luci-go/tree/master/mmutex`,
47 Commands: []*subcommands.Command{ 48 Commands: []*subcommands.Command{
48 cmdExclusive, 49 cmdExclusive,
49 subcommands.CmdHelp, 50 subcommands.CmdHelp,
50 }, 51 },
51 } 52 }
52 53
53 func main() { 54 func main() {
54 os.Exit(subcommands.Run(application, nil)) 55 os.Exit(subcommands.Run(application, nil))
55 } 56 }
OLDNEW
« no previous file with comments | « mmutex/cmd/mmutex/exclusive_test.go ('k') | mmutex/lib/blocker.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698