diff options
| author | elee <eddy@gfxlabs.io> | 2022-03-18 22:21:57 -0500 |
|---|---|---|
| committer | elee <eddy@gfxlabs.io> | 2022-03-18 22:21:57 -0500 |
| commit | beb406bbbb5e67fc66a02d264c670a8fe11785b7 (patch) | |
| tree | 5a753aefc82d4bb1c34096f7b31803343da41d27 /weed/filer/arangodb/helpers.go | |
| parent | 411c0df3fec3344c3e5538cf56b54c1567162386 (diff) | |
| download | seaweedfs-beb406bbbb5e67fc66a02d264c670a8fe11785b7.tar.xz seaweedfs-beb406bbbb5e67fc66a02d264c670a8fe11785b7.zip | |
fix ls, onBucketDelete still not triggering
Diffstat (limited to 'weed/filer/arangodb/helpers.go')
| -rw-r--r-- | weed/filer/arangodb/helpers.go | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/weed/filer/arangodb/helpers.go b/weed/filer/arangodb/helpers.go index c91ef2be5..943189781 100644 --- a/weed/filer/arangodb/helpers.go +++ b/weed/filer/arangodb/helpers.go @@ -48,15 +48,28 @@ func arrayToBytes(xs []uint64) []byte { return out[:first] } -// gets the bucket name out of filepath +// gets the collection the bucket points to from filepath +func (store *ArangodbStore) extractBucketCollection(ctx context.Context, fullpath util.FullPath) (c driver.Collection, err error) { + bucket, _ := extractBucket(fullpath) + if bucket == "" { + bucket = DEFAULT_COLLECTION + } + c, err = store.ensureBucket(ctx, bucket) + if err != nil { + return nil, err + } + return c, err +} + +// called by extractBucketCollection func extractBucket(fullpath util.FullPath) (string, string) { if !strings.HasPrefix(string(fullpath), BUCKET_PREFIX+"/") { return "", string(fullpath) } - if strings.Count(string(fullpath), "/") < 2 { + if strings.Count(string(fullpath), "/") < 3 { return "", string(fullpath) } - bucketAndObjectKey := string(fullpath)[len("/buckets/"):] + bucketAndObjectKey := string(fullpath)[len(BUCKET_PREFIX+"/"):] t := strings.Index(bucketAndObjectKey, "/") bucket := bucketAndObjectKey shortPath := "/" @@ -67,19 +80,6 @@ func extractBucket(fullpath util.FullPath) (string, string) { return bucket, shortPath } -// gets the collection the bucket points to from filepath -func (store *ArangodbStore) extractBucketCollection(ctx context.Context, fullpath util.FullPath) (c driver.Collection, err error) { - bucket, _ := extractBucket(fullpath) - if bucket == "" { - bucket = DEFAULT_COLLECTION - } - c, err = store.ensureBucket(ctx, bucket) - if err != nil { - return nil, err - } - return c, err -} - // get bucket collection from cache. if not exist, creates the buckets collection and grab it func (store *ArangodbStore) ensureBucket(ctx context.Context, bucket string) (bc driver.Collection, err error) { var ok bool |
