projects
/
arvados.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b9e48b6
)
7179: A few golint suggested updates. There are still a lot of golint complaints.
author
radhika <radhika@curoverse.com>
Sat, 12 Sep 2015 00:33:50 +0000
(20:33 -0400)
committer
radhika <radhika@curoverse.com>
Sat, 12 Sep 2015 00:33:50 +0000
(20:33 -0400)
services/keepstore/volume.go
patch
|
blob
|
history
services/keepstore/volume_generic_test.go
patch
|
blob
|
history
services/keepstore/volume_unix_test.go
patch
|
blob
|
history
services/keepstore/work_queue.go
patch
|
blob
|
history
diff --git
a/services/keepstore/volume.go
b/services/keepstore/volume.go
index daf003e1956a6dd1d951a8b17394ae7ec792ee71..cdaec9232685dffe50b485bdcbdac22ce0486c74 100644
(file)
--- a/
services/keepstore/volume.go
+++ b/
services/keepstore/volume.go
@@
-1,7
+1,3
@@
-// A Volume is an interface representing a Keep back-end storage unit:
-// for example, a single mounted disk, a RAID array, an Amazon S3 volume,
-// etc.
-
package main
import (
package main
import (
@@
-10,6
+6,9
@@
import (
"time"
)
"time"
)
+// A Volume is an interface representing a Keep back-end storage unit:
+// for example, a single mounted disk, a RAID array, an Amazon S3 volume,
+// etc.
type Volume interface {
// Get a block. IFF the returned error is nil, the caller must
// put the returned slice back into the buffer pool when it's
type Volume interface {
// Get a block. IFF the returned error is nil, the caller must
// put the returned slice back into the buffer pool when it's
@@
-228,6
+227,7
@@
type RRVolumeManager struct {
counter uint32
}
counter uint32
}
+// MakeRRVolumeManager initializes RRVolumeManager
func MakeRRVolumeManager(volumes []Volume) *RRVolumeManager {
vm := &RRVolumeManager{}
for _, v := range volumes {
func MakeRRVolumeManager(volumes []Volume) *RRVolumeManager {
vm := &RRVolumeManager{}
for _, v := range volumes {
@@
-239,14
+239,17
@@
func MakeRRVolumeManager(volumes []Volume) *RRVolumeManager {
return vm
}
return vm
}
+// AllReadable returns an array of all readable volumes
func (vm *RRVolumeManager) AllReadable() []Volume {
return vm.readables
}
func (vm *RRVolumeManager) AllReadable() []Volume {
return vm.readables
}
+// AllWritable returns an array of all writable volumes
func (vm *RRVolumeManager) AllWritable() []Volume {
return vm.writables
}
func (vm *RRVolumeManager) AllWritable() []Volume {
return vm.writables
}
+// NextWritable returns the next writable
func (vm *RRVolumeManager) NextWritable() Volume {
if len(vm.writables) == 0 {
return nil
func (vm *RRVolumeManager) NextWritable() Volume {
if len(vm.writables) == 0 {
return nil
@@
-255,10
+258,11
@@
func (vm *RRVolumeManager) NextWritable() Volume {
return vm.writables[i%uint32(len(vm.writables))]
}
return vm.writables[i%uint32(len(vm.writables))]
}
+// Close the RRVolumeManager
func (vm *RRVolumeManager) Close() {
}
func (vm *RRVolumeManager) Close() {
}
-// VolumeStatus
+// VolumeStatus
provides status information of the volume consisting of:
// * mount_point
// * device_num (an integer identifying the underlying storage system)
// * bytes_free
// * mount_point
// * device_num (an integer identifying the underlying storage system)
// * bytes_free
diff --git
a/services/keepstore/volume_generic_test.go
b/services/keepstore/volume_generic_test.go
index 9e2e6c639a1f8c851b32fbf19c70f17520c706b3..3c4b0517adeac7eab66053dcaccc034403a91cef 100644
(file)
--- a/
services/keepstore/volume_generic_test.go
+++ b/
services/keepstore/volume_generic_test.go
@@
-299,18
+299,18
@@
func testIndexTo(t *testing.T, factory TestableVolumeFactory) {
buf := new(bytes.Buffer)
v.IndexTo("", buf)
buf := new(bytes.Buffer)
v.IndexTo("", buf)
- index
_r
ows := strings.Split(string(buf.Bytes()), "\n")
- sort.Strings(index
_r
ows)
- sorted
_index := strings.Join(index_r
ows, "\n")
+ index
R
ows := strings.Split(string(buf.Bytes()), "\n")
+ sort.Strings(index
R
ows)
+ sorted
Index := strings.Join(indexR
ows, "\n")
m, err := regexp.MatchString(
`^\n`+TEST_HASH+`\+\d+ \d+\n`+
TEST_HASH_3+`\+\d+ \d+\n`+
TEST_HASH_2+`\+\d+ \d+$`,
m, err := regexp.MatchString(
`^\n`+TEST_HASH+`\+\d+ \d+\n`+
TEST_HASH_3+`\+\d+ \d+\n`+
TEST_HASH_2+`\+\d+ \d+$`,
- sorted
_i
ndex)
+ sorted
I
ndex)
if err != nil {
t.Error(err)
} else if !m {
if err != nil {
t.Error(err)
} else if !m {
- t.Errorf("Got index %q for empty prefix", sorted
_i
ndex)
+ t.Errorf("Got index %q for empty prefix", sorted
I
ndex)
}
for _, prefix := range []string{"f", "f15", "f15ac"} {
}
for _, prefix := range []string{"f", "f15", "f15ac"} {
diff --git
a/services/keepstore/volume_unix_test.go
b/services/keepstore/volume_unix_test.go
index f23a9c9c8ee450981c373c167823733ea15306fc..011471c7add67e95457a374df30cfdb679a7716d 100644
(file)
--- a/
services/keepstore/volume_unix_test.go
+++ b/
services/keepstore/volume_unix_test.go
@@
-163,17
+163,17
@@
func TestIsFull(t *testing.T) {
v := NewTestableUnixVolume(t, false, false)
defer v.Teardown()
v := NewTestableUnixVolume(t, false, false)
defer v.Teardown()
- full
_p
ath := v.root + "/full"
+ full
P
ath := v.root + "/full"
now := fmt.Sprintf("%d", time.Now().Unix())
now := fmt.Sprintf("%d", time.Now().Unix())
- os.Symlink(now, full
_p
ath)
+ os.Symlink(now, full
P
ath)
if !v.IsFull() {
t.Errorf("%s: claims not to be full", v)
}
if !v.IsFull() {
t.Errorf("%s: claims not to be full", v)
}
- os.Remove(full
_p
ath)
+ os.Remove(full
P
ath)
// Test with an expired /full link.
expired := fmt.Sprintf("%d", time.Now().Unix()-3605)
// Test with an expired /full link.
expired := fmt.Sprintf("%d", time.Now().Unix()-3605)
- os.Symlink(expired, full
_p
ath)
+ os.Symlink(expired, full
P
ath)
if v.IsFull() {
t.Errorf("%s: should no longer be full", v)
}
if v.IsFull() {
t.Errorf("%s: should no longer be full", v)
}
diff --git
a/services/keepstore/work_queue.go
b/services/keepstore/work_queue.go
index f1878ffbbc550250ab88c5ea9a4a694d12d63132..27646ad3d8d98c9b58e8693c079e3b40a14d1e1e 100644
(file)
--- a/
services/keepstore/work_queue.go
+++ b/
services/keepstore/work_queue.go
@@
-84,6
+84,7
@@
package main
import "container/list"
import "container/list"
+// WorkQueue definition
type WorkQueue struct {
getStatus chan WorkQueueStatus
newlist chan *list.List
type WorkQueue struct {
getStatus chan WorkQueueStatus
newlist chan *list.List
@@
-96,6
+97,7
@@
type WorkQueue struct {
DoneItem chan<- struct{}
}
DoneItem chan<- struct{}
}
+// WorkQueueStatus reflects the queue status.
type WorkQueueStatus struct {
InProgress int
Queued int
type WorkQueueStatus struct {
InProgress int
Queued int