From 9a016a139d46241c1d30a66534ffb9f9895c4c46 Mon Sep 17 00:00:00 2001 From: Aaron Lehmann Date: Wed, 21 Jun 2017 14:19:44 -0700 Subject: [PATCH] agent: Use bucket key constants Instead of repeating the literal key, use the constants that are already defined. Signed-off-by: Aaron Lehmann --- agent/storage.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/agent/storage.go b/agent/storage.go index f488de7638..a49ad81fa4 100644 --- a/agent/storage.go +++ b/agent/storage.go @@ -35,7 +35,7 @@ func GetTask(tx *bolt.Tx, id string) (*api.Task, error) { var t api.Task if err := withTaskBucket(tx, id, func(bkt *bolt.Bucket) error { - p := bkt.Get([]byte("data")) + p := bkt.Get(bucketKeyData) if p == nil { return errTaskUnknown } @@ -136,7 +136,7 @@ func PutTaskStatus(tx *bolt.Tx, id string, status *api.TaskStatus) error { if err != nil { return err } - return bkt.Put([]byte("status"), p) + return bkt.Put(bucketKeyStatus, p) }) } @@ -154,9 +154,9 @@ func DeleteTask(tx *bolt.Tx, id string) error { func SetTaskAssignment(tx *bolt.Tx, id string, assigned bool) error { return withTaskBucket(tx, id, func(bkt *bolt.Bucket) error { if assigned { - return bkt.Put([]byte("assigned"), []byte{0xFF}) + return bkt.Put(bucketKeyAssigned, []byte{0xFF}) } - return bkt.Delete([]byte("assigned")) + return bkt.Delete(bucketKeyAssigned) }) }