[ARVADOS] created: 0f89acd51a22391e00b5cb270ca93e48357fd618
Git user
git at public.curoverse.com
Mon Oct 17 08:08:16 EDT 2016
at 0f89acd51a22391e00b5cb270ca93e48357fd618 (commit)
commit 0f89acd51a22391e00b5cb270ca93e48357fd618
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Oct 17 08:06:05 2016 -0400
10281: Add DirectoryReplication config.
diff --git a/services/keepstore/volume_unix.go b/services/keepstore/volume_unix.go
index 92c897e..0459f23 100644
--- a/services/keepstore/volume_unix.go
+++ b/services/keepstore/volume_unix.go
@@ -101,9 +101,10 @@ func (vs *unixVolumeAdder) Discover() int {
// A UnixVolume stores and retrieves blocks in a local directory.
type UnixVolume struct {
- Root string // path to the volume's root directory
- ReadOnly bool
- Serialize bool
+ Root string // path to the volume's root directory
+ ReadOnly bool
+ Serialize bool
+ DirectoryReplication int
// something to lock during IO, typically a sync.Mutex (or nil
// to skip locking)
@@ -114,12 +115,14 @@ type UnixVolume struct {
func (*UnixVolume) Examples() []Volume {
return []Volume{
&UnixVolume{
- Root: "/mnt/local-disk",
- Serialize: true,
+ Root: "/mnt/local-disk",
+ Serialize: true,
+ DirectoryReplication: 1,
},
&UnixVolume{
- Root: "/mnt/network-disk",
- Serialize: false,
+ Root: "/mnt/network-disk",
+ Serialize: false,
+ DirectoryReplication: 2,
},
}
}
@@ -137,6 +140,9 @@ func (v *UnixVolume) Start() error {
if !strings.HasPrefix(v.Root, "/") {
return fmt.Errorf("volume root does not start with '/': %q", v.Root)
}
+ if v.DirectoryReplication == 0 {
+ v.DirectoryReplication = 1
+ }
_, err := os.Stat(v.Root)
return err
}
@@ -535,7 +541,7 @@ func (v *UnixVolume) Writable() bool {
// Replication returns the number of replicas promised by the
// underlying device (currently assumed to be 1).
func (v *UnixVolume) Replication() int {
- return 1
+ return v.DirectoryReplication
}
// lockfile and unlockfile use flock(2) to manage kernel file locks.
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list