[ARVADOS] updated: da74a60c2d276ed8612f138d73e73787f450ea2e

git at public.curoverse.com git at public.curoverse.com
Thu Sep 24 01:56:01 EDT 2015


Summary of changes:
 services/keepstore/azure_blob_volume.go | 37 +++++++++++++++++++++++++++++----
 1 file changed, 33 insertions(+), 4 deletions(-)

       via  da74a60c2d276ed8612f138d73e73787f450ea2e (commit)
      from  96c3fcd2d013af7747f20fea55f460ca2d2dd637 (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 da74a60c2d276ed8612f138d73e73787f450ea2e
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Sep 24 01:55:54 2015 -0400

    7241: Add Delete, IndexTo, Touch, and Mtime.

diff --git a/services/keepstore/azure_blob_volume.go b/services/keepstore/azure_blob_volume.go
index 8430d8b..0d0e546 100644
--- a/services/keepstore/azure_blob_volume.go
+++ b/services/keepstore/azure_blob_volume.go
@@ -128,19 +128,48 @@ func (v *AzureBlobVolume) Put(loc string, block []byte) error {
 }
 
 func (v *AzureBlobVolume) Touch(loc string) error {
-	return NotFoundError
+	return v.bsClient.PutBlockList(v.containerName, loc, []storage.Block{{"MA==", storage.BlockStatusCommitted}})
 }
 
 func (v *AzureBlobVolume) Mtime(loc string) (time.Time, error) {
-	return time.Time{}, NotFoundError
+	props, err := v.bsClient.GetBlobProperties(v.containerName, loc)
+	if err != nil {
+		return time.Time{}, err
+	}
+	return time.Parse(time.RFC1123, props.LastModified)
 }
 
 func (v *AzureBlobVolume) IndexTo(prefix string, writer io.Writer) error {
-	return nil
+	params := storage.ListBlobsParameters{
+		Prefix: prefix,
+	}
+	for {
+		resp, err := v.bsClient.ListBlobs(v.containerName, params)
+		if err != nil {
+			return err
+		}
+		for _, b := range resp.Blobs {
+			t, err := time.Parse(time.RFC1123, b.Properties.LastModified)
+			if err != nil {
+				return err
+			}
+			fmt.Fprintf(writer, "%s+%d\n", b.Name, t.Unix())
+		}
+		if resp.NextMarker == "" {
+			return nil
+		}
+		params.Marker = resp.NextMarker
+	}
 }
 
 func (v *AzureBlobVolume) Delete(loc string) error {
-	return NotFoundError
+	// TODO: Use leases to handle races with Touch and Put.
+	if t, err := v.Mtime(loc); err != nil {
+		return err
+	} else if time.Since(t) < blobSignatureTTL {
+		return nil
+	}
+	return v.bsClient.DeleteBlob(v.containerName, loc)
 }
 
 func (v *AzureBlobVolume) Status() *VolumeStatus {

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list