[ARVADOS] updated: 3b1598bb557a30f9a896ed36988702c5ae9f2ba9
git at public.curoverse.com
git at public.curoverse.com
Tue Sep 15 12:20:16 EDT 2015
Summary of changes:
services/keepstore/handler_test.go | 56 +++++++++++++++----------------
services/keepstore/handlers.go | 6 ++--
services/keepstore/keepstore.go | 52 ++++++++++++++--------------
services/keepstore/keepstore_test.go | 2 +-
services/keepstore/pull_worker_test.go | 34 +++++++++----------
services/keepstore/trash_worker.go | 10 +++---
services/keepstore/trash_worker_test.go | 20 +++++------
services/keepstore/volume.go | 4 +--
services/keepstore/volume_generic_test.go | 4 +--
services/keepstore/volume_test.go | 2 +-
services/keepstore/volume_unix.go | 4 +--
11 files changed, 97 insertions(+), 97 deletions(-)
via 3b1598bb557a30f9a896ed36988702c5ae9f2ba9 (commit)
via 0041395d00cda5ddeb488dae2d9fae7b6b437c9d (commit)
from 04a40b8028387c4b8899d6b5b0a55d349ddab04b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 3b1598bb557a30f9a896ed36988702c5ae9f2ba9
Author: radhika <radhika at curoverse.com>
Date: Tue Sep 15 12:16:31 2015 -0400
7179: more updates to address golint suggestions around the config parameters such as never-delete, blob-signature-ttl etc.
diff --git a/services/keepstore/handler_test.go b/services/keepstore/handler_test.go
index 4ea4329..dd83666 100644
--- a/services/keepstore/handler_test.go
+++ b/services/keepstore/handler_test.go
@@ -54,11 +54,11 @@ func TestGetHandler(t *testing.T) {
// Turn on permission settings so we can generate signed locators.
enforcePermissions = true
PermissionSecret = []byte(knownKey)
- blob_signature_ttl = 300 * time.Second
+ blobSignatureTTL = 300 * time.Second
var (
unsignedLocator = "/" + TestHash
- validTimestamp = time.Now().Add(blob_signature_ttl)
+ validTimestamp = time.Now().Add(blobSignatureTTL)
expiredTimestamp = time.Now().Add(-time.Hour)
signedLocator = "/" + SignLocator(TestHash, knownToken, validTimestamp)
expiredLocator = "/" + SignLocator(TestHash, knownToken, expiredTimestamp)
@@ -176,7 +176,7 @@ func TestPutHandler(t *testing.T) {
// With a server key.
PermissionSecret = []byte(knownKey)
- blob_signature_ttl = 300 * time.Second
+ blobSignatureTTL = 300 * time.Second
// When a permission key is available, the locator returned
// from an authenticated PUT request will be signed.
@@ -220,7 +220,7 @@ func TestPutHandler(t *testing.T) {
func TestPutAndDeleteSkipReadonlyVolumes(t *testing.T) {
defer teardown()
- data_manager_token = "fake-data-manager-token"
+ dataManagerToken = "fake-data-manager-token"
vols := []*MockVolume{CreateMockVolume(), CreateMockVolume()}
vols[0].Readonly = true
KeepVM = MakeRRVolumeManager([]Volume{vols[0], vols[1]})
@@ -232,15 +232,15 @@ func TestPutAndDeleteSkipReadonlyVolumes(t *testing.T) {
requestBody: TestBlock,
})
defer func(orig bool) {
- never_delete = orig
- }(never_delete)
- never_delete = false
+ neverDelete = orig
+ }(neverDelete)
+ neverDelete = false
IssueRequest(
&RequestTester{
method: "DELETE",
uri: "/" + TestHash,
requestBody: TestBlock,
- apiToken: data_manager_token,
+ apiToken: dataManagerToken,
})
type expect struct {
volnum int
@@ -291,7 +291,7 @@ func TestIndexHandler(t *testing.T) {
vols[0].Put(TestHash+".meta", []byte("metadata"))
vols[1].Put(TestHash2+".meta", []byte("metadata"))
- data_manager_token = "DATA MANAGER TOKEN"
+ dataManagerToken = "DATA MANAGER TOKEN"
unauthenticatedReq := &RequestTester{
method: "GET",
@@ -305,7 +305,7 @@ func TestIndexHandler(t *testing.T) {
superuserReq := &RequestTester{
method: "GET",
uri: "/index",
- apiToken: data_manager_token,
+ apiToken: dataManagerToken,
}
unauthPrefixReq := &RequestTester{
method: "GET",
@@ -319,7 +319,7 @@ func TestIndexHandler(t *testing.T) {
superuserPrefixReq := &RequestTester{
method: "GET",
uri: "/index/" + TestHash[0:3],
- apiToken: data_manager_token,
+ apiToken: dataManagerToken,
}
// -------------------------------------------------------------
@@ -447,15 +447,15 @@ func TestDeleteHandler(t *testing.T) {
vols := KeepVM.AllWritable()
vols[0].Put(TestHash, TestBlock)
- // Explicitly set the blob_signature_ttl to 0 for these
+ // Explicitly set the blobSignatureTTL to 0 for these
// tests, to ensure the MockVolume deletes the blocks
// even though they have just been created.
- blob_signature_ttl = time.Duration(0)
+ blobSignatureTTL = time.Duration(0)
var userToken = "NOT DATA MANAGER TOKEN"
- data_manager_token = "DATA MANAGER TOKEN"
+ dataManagerToken = "DATA MANAGER TOKEN"
- never_delete = false
+ neverDelete = false
unauthReq := &RequestTester{
method: "DELETE",
@@ -471,13 +471,13 @@ func TestDeleteHandler(t *testing.T) {
superuserExistingBlockReq := &RequestTester{
method: "DELETE",
uri: "/" + TestHash,
- apiToken: data_manager_token,
+ apiToken: dataManagerToken,
}
superuserNonexistentBlockReq := &RequestTester{
method: "DELETE",
uri: "/" + TestHash2,
- apiToken: data_manager_token,
+ apiToken: dataManagerToken,
}
// Unauthenticated request returns PermissionError.
@@ -508,14 +508,14 @@ func TestDeleteHandler(t *testing.T) {
http.StatusNotFound,
response)
- // Authenticated admin request for existing block while never_delete is set.
- never_delete = true
+ // Authenticated admin request for existing block while neverDelete is set.
+ neverDelete = true
response = IssueRequest(superuserExistingBlockReq)
ExpectStatusCode(t,
"authenticated request, existing block, method disabled",
MethodDisabledError.HTTPCode,
response)
- never_delete = false
+ neverDelete = false
// Authenticated admin request for existing block.
response = IssueRequest(superuserExistingBlockReq)
@@ -537,10 +537,10 @@ func TestDeleteHandler(t *testing.T) {
t.Error("superuserExistingBlockReq: block not deleted")
}
- // A DELETE request on a block newer than blob_signature_ttl
+ // A DELETE request on a block newer than blobSignatureTTL
// should return success but leave the block on the volume.
vols[0].Put(TestHash, TestBlock)
- blob_signature_ttl = time.Hour
+ blobSignatureTTL = time.Hour
response = IssueRequest(superuserExistingBlockReq)
ExpectStatusCode(t,
@@ -592,7 +592,7 @@ func TestPullHandler(t *testing.T) {
defer teardown()
var userToken = "USER TOKEN"
- data_manager_token = "DATA MANAGER TOKEN"
+ dataManagerToken = "DATA MANAGER TOKEN"
pullq = NewWorkQueue()
@@ -637,13 +637,13 @@ func TestPullHandler(t *testing.T) {
},
{
"Valid pull request from the data manager",
- RequestTester{"/pull", data_manager_token, "PUT", goodJSON},
+ RequestTester{"/pull", dataManagerToken, "PUT", goodJSON},
http.StatusOK,
"Received 3 pull requests\n",
},
{
"Invalid pull request from the data manager",
- RequestTester{"/pull", data_manager_token, "PUT", badJSON},
+ RequestTester{"/pull", dataManagerToken, "PUT", badJSON},
http.StatusBadRequest,
"",
},
@@ -698,7 +698,7 @@ func TestTrashHandler(t *testing.T) {
defer teardown()
var userToken = "USER TOKEN"
- data_manager_token = "DATA MANAGER TOKEN"
+ dataManagerToken = "DATA MANAGER TOKEN"
trashq = NewWorkQueue()
@@ -741,13 +741,13 @@ func TestTrashHandler(t *testing.T) {
},
{
"Valid trash list from the data manager",
- RequestTester{"/trash", data_manager_token, "PUT", goodJSON},
+ RequestTester{"/trash", dataManagerToken, "PUT", goodJSON},
http.StatusOK,
"Received 3 trash requests\n",
},
{
"Invalid trash list from the data manager",
- RequestTester{"/trash", data_manager_token, "PUT", badJSON},
+ RequestTester{"/trash", dataManagerToken, "PUT", badJSON},
http.StatusBadRequest,
"",
},
diff --git a/services/keepstore/handlers.go b/services/keepstore/handlers.go
index 8c9b849..2b96dbc 100644
--- a/services/keepstore/handlers.go
+++ b/services/keepstore/handlers.go
@@ -134,7 +134,7 @@ func PutBlockHandler(resp http.ResponseWriter, req *http.Request) {
returnHash := fmt.Sprintf("%s+%d", hash, req.ContentLength)
apiToken := GetApiToken(req)
if PermissionSecret != nil && apiToken != "" {
- expiry := time.Now().Add(blob_signature_ttl)
+ expiry := time.Now().Add(blobSignatureTTL)
returnHash = SignLocator(returnHash, apiToken, expiry)
}
resp.Write([]byte(returnHash + "\n"))
@@ -281,7 +281,7 @@ func DeleteHandler(resp http.ResponseWriter, req *http.Request) {
return
}
- if never_delete {
+ if neverDelete {
http.Error(resp, MethodDisabledError.Error(), MethodDisabledError.HTTPCode)
return
}
@@ -662,5 +662,5 @@ func CanDelete(apiToken string) bool {
// IsDataManagerToken returns true if apiToken represents the data
// manager's token.
func IsDataManagerToken(apiToken string) bool {
- return data_manager_token != "" && apiToken == data_manager_token
+ return dataManagerToken != "" && apiToken == dataManagerToken
}
diff --git a/services/keepstore/keepstore.go b/services/keepstore/keepstore.go
index 9c84534..c4a12c5 100644
--- a/services/keepstore/keepstore.go
+++ b/services/keepstore/keepstore.go
@@ -44,19 +44,19 @@ var ProcMounts = "/proc/mounts"
// Initialized by the -enforce-permissions flag.
var enforcePermissions bool
-// blob_signature_ttl is the time duration for which new permission
+// blobSignatureTTL is the time duration for which new permission
// signatures (returned by PUT requests) will be valid.
// Initialized by the -permission-ttl flag.
-var blob_signature_ttl time.Duration
+var blobSignatureTTL time.Duration
-// data_manager_token represents the API token used by the
+// dataManagerToken represents the API token used by the
// Data Manager, and is required on certain privileged operations.
// Initialized by the -data-manager-token-file flag.
-var data_manager_token string
+var dataManagerToken string
-// never_delete can be used to prevent the DELETE handler from
+// neverDelete can be used to prevent the DELETE handler from
// actually deleting anything.
-var never_delete = true
+var neverDelete = true
var maxBuffers = 128
var bufs *bufferPool
@@ -211,15 +211,15 @@ func main() {
defer log.Println("keepstore exiting, pid", os.Getpid())
var (
- data_manager_token_file string
- listen string
- blob_signing_key_file string
- permission_ttl_sec int
- volumes volumeSet
- pidfile string
+ dataManagerTokenFile string
+ listen string
+ blobSigningKeyFile string
+ permissionTTLSec int
+ volumes volumeSet
+ pidfile string
)
flag.StringVar(
- &data_manager_token_file,
+ &dataManagerTokenFile,
"data-manager-token-file",
"",
"File with the API token used by the Data Manager. All DELETE "+
@@ -235,29 +235,29 @@ func main() {
DefaultAddr,
"Listening address, in the form \"host:port\". e.g., 10.0.1.24:8000. Omit the host part to listen on all interfaces.")
flag.BoolVar(
- &never_delete,
+ &neverDelete,
"never-delete",
true,
"If set, nothing will be deleted. HTTP 405 will be returned "+
"for valid DELETE requests.")
flag.StringVar(
- &blob_signing_key_file,
+ &blobSigningKeyFile,
"permission-key-file",
"",
"Synonym for -blob-signing-key-file.")
flag.StringVar(
- &blob_signing_key_file,
+ &blobSigningKeyFile,
"blob-signing-key-file",
"",
"File containing the secret key for generating and verifying "+
"blob permission signatures.")
flag.IntVar(
- &permission_ttl_sec,
+ &permissionTTLSec,
"permission-ttl",
0,
"Synonym for -blob-signature-ttl.")
flag.IntVar(
- &permission_ttl_sec,
+ &permissionTTLSec,
"blob-signature-ttl",
int(time.Duration(2*7*24*time.Hour).Seconds()),
"Lifetime of blob permission signatures. "+
@@ -293,8 +293,8 @@ func main() {
flag.Parse()
- if never_delete != true {
- log.Fatal("never_delete must be true, see #6221")
+ if neverDelete != true {
+ log.Fatal("neverDelete must be true, see #6221")
}
if maxBuffers < 0 {
@@ -340,22 +340,22 @@ func main() {
// Initialize data manager token and permission key.
// If these tokens are specified but cannot be read,
// raise a fatal error.
- if data_manager_token_file != "" {
- if buf, err := ioutil.ReadFile(data_manager_token_file); err == nil {
- data_manager_token = strings.TrimSpace(string(buf))
+ if dataManagerTokenFile != "" {
+ if buf, err := ioutil.ReadFile(dataManagerTokenFile); err == nil {
+ dataManagerToken = strings.TrimSpace(string(buf))
} else {
log.Fatalf("reading data manager token: %s\n", err)
}
}
- if blob_signing_key_file != "" {
- if buf, err := ioutil.ReadFile(blob_signing_key_file); err == nil {
+ if blobSigningKeyFile != "" {
+ if buf, err := ioutil.ReadFile(blobSigningKeyFile); err == nil {
PermissionSecret = bytes.TrimSpace(buf)
} else {
log.Fatalf("reading permission key: %s\n", err)
}
}
- blob_signature_ttl = time.Duration(permission_ttl_sec) * time.Second
+ blobSignatureTTL = time.Duration(permissionTTLSec) * time.Second
if PermissionSecret == nil {
if enforcePermissions {
diff --git a/services/keepstore/keepstore_test.go b/services/keepstore/keepstore_test.go
index dc641ab..3807317 100644
--- a/services/keepstore/keepstore_test.go
+++ b/services/keepstore/keepstore_test.go
@@ -430,7 +430,7 @@ func MakeTestVolumeManager(numVolumes int) VolumeManager {
// teardown cleans up after each test.
func teardown() {
- data_manager_token = ""
+ dataManagerToken = ""
enforcePermissions = false
PermissionSecret = nil
KeepVM = nil
diff --git a/services/keepstore/pull_worker_test.go b/services/keepstore/pull_worker_test.go
index ed0d24a..c6a4195 100644
--- a/services/keepstore/pull_worker_test.go
+++ b/services/keepstore/pull_worker_test.go
@@ -91,10 +91,10 @@ type PullWorkerTestData struct {
func (s *PullWorkerTestSuite) TestPullWorkerPullList_with_two_locators(c *C) {
defer teardown()
- data_manager_token = "DATA MANAGER TOKEN"
+ dataManagerToken = "DATA MANAGER TOKEN"
testData := PullWorkerTestData{
name: "TestPullWorkerPullList_with_two_locators",
- req: RequestTester{"/pull", data_manager_token, "PUT", firstPullList},
+ req: RequestTester{"/pull", dataManagerToken, "PUT", firstPullList},
responseCode: http.StatusOK,
responseBody: "Received 2 pull requests\n",
readContent: "hello",
@@ -108,10 +108,10 @@ func (s *PullWorkerTestSuite) TestPullWorkerPullList_with_two_locators(c *C) {
func (s *PullWorkerTestSuite) TestPullWorkerPullList_with_one_locator(c *C) {
defer teardown()
- data_manager_token = "DATA MANAGER TOKEN"
+ dataManagerToken = "DATA MANAGER TOKEN"
testData := PullWorkerTestData{
name: "TestPullWorkerPullList_with_one_locator",
- req: RequestTester{"/pull", data_manager_token, "PUT", secondPullList},
+ req: RequestTester{"/pull", dataManagerToken, "PUT", secondPullList},
responseCode: http.StatusOK,
responseBody: "Received 1 pull requests\n",
readContent: "hola",
@@ -125,10 +125,10 @@ func (s *PullWorkerTestSuite) TestPullWorkerPullList_with_one_locator(c *C) {
func (s *PullWorkerTestSuite) TestPullWorker_error_on_get_one_locator(c *C) {
defer teardown()
- data_manager_token = "DATA MANAGER TOKEN"
+ dataManagerToken = "DATA MANAGER TOKEN"
testData := PullWorkerTestData{
name: "TestPullWorker_error_on_get_one_locator",
- req: RequestTester{"/pull", data_manager_token, "PUT", secondPullList},
+ req: RequestTester{"/pull", dataManagerToken, "PUT", secondPullList},
responseCode: http.StatusOK,
responseBody: "Received 1 pull requests\n",
readContent: "unused",
@@ -142,10 +142,10 @@ func (s *PullWorkerTestSuite) TestPullWorker_error_on_get_one_locator(c *C) {
func (s *PullWorkerTestSuite) TestPullWorker_error_on_get_two_locators(c *C) {
defer teardown()
- data_manager_token = "DATA MANAGER TOKEN"
+ dataManagerToken = "DATA MANAGER TOKEN"
testData := PullWorkerTestData{
name: "TestPullWorker_error_on_get_two_locators",
- req: RequestTester{"/pull", data_manager_token, "PUT", firstPullList},
+ req: RequestTester{"/pull", dataManagerToken, "PUT", firstPullList},
responseCode: http.StatusOK,
responseBody: "Received 2 pull requests\n",
readContent: "unused",
@@ -159,10 +159,10 @@ func (s *PullWorkerTestSuite) TestPullWorker_error_on_get_two_locators(c *C) {
func (s *PullWorkerTestSuite) TestPullWorker_error_on_put_one_locator(c *C) {
defer teardown()
- data_manager_token = "DATA MANAGER TOKEN"
+ dataManagerToken = "DATA MANAGER TOKEN"
testData := PullWorkerTestData{
name: "TestPullWorker_error_on_put_one_locator",
- req: RequestTester{"/pull", data_manager_token, "PUT", secondPullList},
+ req: RequestTester{"/pull", dataManagerToken, "PUT", secondPullList},
responseCode: http.StatusOK,
responseBody: "Received 1 pull requests\n",
readContent: "hello hello",
@@ -176,10 +176,10 @@ func (s *PullWorkerTestSuite) TestPullWorker_error_on_put_one_locator(c *C) {
func (s *PullWorkerTestSuite) TestPullWorker_error_on_put_two_locators(c *C) {
defer teardown()
- data_manager_token = "DATA MANAGER TOKEN"
+ dataManagerToken = "DATA MANAGER TOKEN"
testData := PullWorkerTestData{
name: "TestPullWorker_error_on_put_two_locators",
- req: RequestTester{"/pull", data_manager_token, "PUT", firstPullList},
+ req: RequestTester{"/pull", dataManagerToken, "PUT", firstPullList},
responseCode: http.StatusOK,
responseBody: "Received 2 pull requests\n",
readContent: "hello again",
@@ -202,10 +202,10 @@ func (s *PullWorkerTestSuite) TestPullWorkerPullList_with_two_items_latest_repla
pullq.ReplaceQueue(makeTestWorkList(firstInput))
testPullLists["Added_before_actual_test_item"] = string(1)
- data_manager_token = "DATA MANAGER TOKEN"
+ dataManagerToken = "DATA MANAGER TOKEN"
testData := PullWorkerTestData{
name: "TestPullWorkerPullList_with_two_items_latest_replacing_old",
- req: RequestTester{"/pull", data_manager_token, "PUT", secondPullList},
+ req: RequestTester{"/pull", dataManagerToken, "PUT", secondPullList},
responseCode: http.StatusOK,
responseBody: "Received 1 pull requests\n",
readContent: "hola de nuevo",
@@ -217,14 +217,14 @@ func (s *PullWorkerTestSuite) TestPullWorkerPullList_with_two_items_latest_repla
}
// In this case, the item will not be placed on pullq
-func (s *PullWorkerTestSuite) TestPullWorker_invalid_data_manager_token(c *C) {
+func (s *PullWorkerTestSuite) TestPullWorker_invalid_dataManagerToken(c *C) {
defer teardown()
- data_manager_token = "DATA MANAGER TOKEN"
+ dataManagerToken = "DATA MANAGER TOKEN"
testData := PullWorkerTestData{
name: "TestPullWorkerPullList_with_two_locators",
- req: RequestTester{"/pull", "invalid_data_manager_token", "PUT", firstPullList},
+ req: RequestTester{"/pull", "invalid_dataManagerToken", "PUT", firstPullList},
responseCode: http.StatusUnauthorized,
responseBody: "Unauthorized\n",
readContent: "hello",
diff --git a/services/keepstore/trash_worker.go b/services/keepstore/trash_worker.go
index 7e19ba4..65e3fbd 100644
--- a/services/keepstore/trash_worker.go
+++ b/services/keepstore/trash_worker.go
@@ -23,13 +23,13 @@ func RunTrashWorker(trashq *WorkQueue) {
// TrashItem deletes the indicated block from every writable volume.
func TrashItem(trashRequest TrashRequest) {
reqMtime := time.Unix(trashRequest.BlockMtime, 0)
- if time.Since(reqMtime) < blob_signature_ttl {
- log.Printf("WARNING: data manager asked to delete a %v old block %v (BlockMtime %d = %v), but my blob_signature_ttl is %v! Skipping.",
+ if time.Since(reqMtime) < blobSignatureTTL {
+ log.Printf("WARNING: data manager asked to delete a %v old block %v (BlockMtime %d = %v), but my blobSignatureTTL is %v! Skipping.",
time.Since(reqMtime),
trashRequest.Locator,
trashRequest.BlockMtime,
reqMtime,
- blob_signature_ttl)
+ blobSignatureTTL)
return
}
@@ -44,8 +44,8 @@ func TrashItem(trashRequest TrashRequest) {
continue
}
- if never_delete {
- err = errors.New("did not delete block because never_delete is true")
+ if neverDelete {
+ err = errors.New("did not delete block because neverDelete is true")
} else {
err = volume.Delete(trashRequest.Locator)
}
diff --git a/services/keepstore/trash_worker_test.go b/services/keepstore/trash_worker_test.go
index 016ad28..1d3063a 100644
--- a/services/keepstore/trash_worker_test.go
+++ b/services/keepstore/trash_worker_test.go
@@ -31,7 +31,7 @@ type TrashWorkerTestData struct {
Expect no errors.
*/
func TestTrashWorkerIntegration_GetNonExistingLocator(t *testing.T) {
- never_delete = false
+ neverDelete = false
testData := TrashWorkerTestData{
Locator1: "5d41402abc4b2a76b9719d911017c592",
Block1: []byte("hello"),
@@ -53,7 +53,7 @@ func TestTrashWorkerIntegration_GetNonExistingLocator(t *testing.T) {
Expect the second locator in volume 2 to be unaffected.
*/
func TestTrashWorkerIntegration_LocatorInVolume1(t *testing.T) {
- never_delete = false
+ neverDelete = false
testData := TrashWorkerTestData{
Locator1: TestHash,
Block1: TestBlock,
@@ -75,7 +75,7 @@ func TestTrashWorkerIntegration_LocatorInVolume1(t *testing.T) {
Expect the first locator in volume 1 to be unaffected.
*/
func TestTrashWorkerIntegration_LocatorInVolume2(t *testing.T) {
- never_delete = false
+ neverDelete = false
testData := TrashWorkerTestData{
Locator1: TestHash,
Block1: TestBlock,
@@ -97,7 +97,7 @@ func TestTrashWorkerIntegration_LocatorInVolume2(t *testing.T) {
Expect locator to be deleted from both volumes.
*/
func TestTrashWorkerIntegration_LocatorInBothVolumes(t *testing.T) {
- never_delete = false
+ neverDelete = false
testData := TrashWorkerTestData{
Locator1: TestHash,
Block1: TestBlock,
@@ -119,7 +119,7 @@ func TestTrashWorkerIntegration_LocatorInBothVolumes(t *testing.T) {
Delete the second and expect the first to be still around.
*/
func TestTrashWorkerIntegration_MtimeMatchesForLocator1ButNotForLocator2(t *testing.T) {
- never_delete = false
+ neverDelete = false
testData := TrashWorkerTestData{
Locator1: TestHash,
Block1: TestBlock,
@@ -143,7 +143,7 @@ func TestTrashWorkerIntegration_MtimeMatchesForLocator1ButNotForLocator2(t *test
Expect the other unaffected.
*/
func TestTrashWorkerIntegration_TwoDifferentLocatorsInVolume1(t *testing.T) {
- never_delete = false
+ neverDelete = false
testData := TrashWorkerTestData{
Locator1: TestHash,
Block1: TestBlock,
@@ -166,7 +166,7 @@ func TestTrashWorkerIntegration_TwoDifferentLocatorsInVolume1(t *testing.T) {
will not be deleted becuase its Mtime is within the trash life time.
*/
func TestTrashWorkerIntegration_SameLocatorInTwoVolumesWithDefaultTrashLifeTime(t *testing.T) {
- never_delete = false
+ neverDelete = false
testData := TrashWorkerTestData{
Locator1: TestHash,
Block1: TestBlock,
@@ -188,11 +188,11 @@ func TestTrashWorkerIntegration_SameLocatorInTwoVolumesWithDefaultTrashLifeTime(
performTrashWorkerTest(testData, t)
}
-/* Delete a block with matching mtime for locator in both volumes, but never_delete is true,
+/* Delete a block with matching mtime for locator in both volumes, but neverDelete is true,
so block won't be deleted.
*/
func TestTrashWorkerIntegration_NeverDelete(t *testing.T) {
- never_delete = true
+ neverDelete = true
testData := TrashWorkerTestData{
Locator1: TestHash,
Block1: TestBlock,
@@ -231,7 +231,7 @@ func performTrashWorkerTest(testData TrashWorkerTestData, t *testing.T) {
}
}
- oldBlockTime := time.Now().Add(-blob_signature_ttl - time.Minute)
+ oldBlockTime := time.Now().Add(-blobSignatureTTL - time.Minute)
// Create TrashRequest for the test
trashRequest := TrashRequest{
diff --git a/services/keepstore/volume.go b/services/keepstore/volume.go
index e6a0f27..9bf291b 100644
--- a/services/keepstore/volume.go
+++ b/services/keepstore/volume.go
@@ -150,7 +150,7 @@ type Volume interface {
// loc is as described in Get.
//
// If the timestamp for the given locator is newer than
- // blob_signature_ttl, Delete must not delete the data.
+ // blobSignatureTTL, Delete must not delete the data.
//
// If a Delete operation overlaps with any Touch or Put
// operations on the same locator, the implementation must
@@ -171,7 +171,7 @@ type Volume interface {
// reliably or fail outright.
//
// Corollary: A successful Touch or Put guarantees a block
- // will not be deleted for at least blob_signature_ttl
+ // will not be deleted for at least blobSignatureTTL
// seconds.
Delete(loc string) error
diff --git a/services/keepstore/volume_generic_test.go b/services/keepstore/volume_generic_test.go
index 0218d40..193d9d2 100644
--- a/services/keepstore/volume_generic_test.go
+++ b/services/keepstore/volume_generic_test.go
@@ -380,7 +380,7 @@ func testDeleteNewBlock(t *testing.T, factory TestableVolumeFactory) {
}
// Calling Delete() for a block with a timestamp older than
-// blob_signature_ttl seconds in the past should delete the data.
+// blobSignatureTTL seconds in the past should delete the data.
// Test is intended for only writable volumes
func testDeleteOldBlock(t *testing.T, factory TestableVolumeFactory) {
v := factory(t)
@@ -391,7 +391,7 @@ func testDeleteOldBlock(t *testing.T, factory TestableVolumeFactory) {
}
v.Put(TestHash, TestBlock)
- v.TouchWithDate(TestHash, time.Now().Add(-2*blob_signature_ttl*time.Second))
+ v.TouchWithDate(TestHash, time.Now().Add(-2*blobSignatureTTL*time.Second))
if err := v.Delete(TestHash); err != nil {
t.Error(err)
diff --git a/services/keepstore/volume_test.go b/services/keepstore/volume_test.go
index 5467ed5..f272c84 100644
--- a/services/keepstore/volume_test.go
+++ b/services/keepstore/volume_test.go
@@ -190,7 +190,7 @@ func (v *MockVolume) Delete(loc string) error {
return MethodDisabledError
}
if _, ok := v.Store[loc]; ok {
- if time.Since(v.Timestamps[loc]) < blob_signature_ttl {
+ if time.Since(v.Timestamps[loc]) < blobSignatureTTL {
return nil
}
delete(v.Store, loc)
diff --git a/services/keepstore/volume_unix.go b/services/keepstore/volume_unix.go
index f4b4971..afae279 100644
--- a/services/keepstore/volume_unix.go
+++ b/services/keepstore/volume_unix.go
@@ -318,7 +318,7 @@ func (v *UnixVolume) Delete(loc string) error {
}
defer unlockfile(f)
- // If the block has been PUT in the last blob_signature_ttl
+ // If the block has been PUT in the last blobSignatureTTL
// seconds, return success without removing the block. This
// protects data from garbage collection until it is no longer
// possible for clients to retrieve the unreferenced blocks
@@ -326,7 +326,7 @@ func (v *UnixVolume) Delete(loc string) error {
if fi, err := os.Stat(p); err != nil {
return err
} else {
- if time.Since(fi.ModTime()) < blob_signature_ttl {
+ if time.Since(fi.ModTime()) < blobSignatureTTL {
return nil
}
}
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list