mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
fix ls, onBucketDelete still not triggering
This commit is contained in:
parent
411c0df3fe
commit
beb406bbbb
|
@ -292,7 +292,7 @@ func (store *ArangodbStore) ListDirectoryEntries(ctx context.Context, dirPath ut
|
||||||
}
|
}
|
||||||
|
|
||||||
func (store *ArangodbStore) ListDirectoryPrefixedEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int64, prefix string, eachEntryFunc filer.ListEachEntryFunc) (lastFileName string, err error) {
|
func (store *ArangodbStore) ListDirectoryPrefixedEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int64, prefix string, eachEntryFunc filer.ListEachEntryFunc) (lastFileName string, err error) {
|
||||||
targetCollection, err := store.extractBucketCollection(ctx, dirPath)
|
targetCollection, err := store.extractBucketCollection(ctx, dirPath+"/")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return lastFileName, err
|
return lastFileName, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,25 +48,6 @@ func arrayToBytes(xs []uint64) []byte {
|
||||||
return out[:first]
|
return out[:first]
|
||||||
}
|
}
|
||||||
|
|
||||||
// gets the bucket name out of filepath
|
|
||||||
func extractBucket(fullpath util.FullPath) (string, string) {
|
|
||||||
if !strings.HasPrefix(string(fullpath), BUCKET_PREFIX+"/") {
|
|
||||||
return "", string(fullpath)
|
|
||||||
}
|
|
||||||
if strings.Count(string(fullpath), "/") < 2 {
|
|
||||||
return "", string(fullpath)
|
|
||||||
}
|
|
||||||
bucketAndObjectKey := string(fullpath)[len("/buckets/"):]
|
|
||||||
t := strings.Index(bucketAndObjectKey, "/")
|
|
||||||
bucket := bucketAndObjectKey
|
|
||||||
shortPath := "/"
|
|
||||||
if t > 0 {
|
|
||||||
bucket = bucketAndObjectKey[:t]
|
|
||||||
shortPath = string(util.FullPath(bucketAndObjectKey[t:]))
|
|
||||||
}
|
|
||||||
return bucket, shortPath
|
|
||||||
}
|
|
||||||
|
|
||||||
// gets the collection the bucket points to from 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) {
|
func (store *ArangodbStore) extractBucketCollection(ctx context.Context, fullpath util.FullPath) (c driver.Collection, err error) {
|
||||||
bucket, _ := extractBucket(fullpath)
|
bucket, _ := extractBucket(fullpath)
|
||||||
|
@ -80,6 +61,25 @@ func (store *ArangodbStore) extractBucketCollection(ctx context.Context, fullpat
|
||||||
return c, 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), "/") < 3 {
|
||||||
|
return "", string(fullpath)
|
||||||
|
}
|
||||||
|
bucketAndObjectKey := string(fullpath)[len(BUCKET_PREFIX+"/"):]
|
||||||
|
t := strings.Index(bucketAndObjectKey, "/")
|
||||||
|
bucket := bucketAndObjectKey
|
||||||
|
shortPath := "/"
|
||||||
|
if t > 0 {
|
||||||
|
bucket = bucketAndObjectKey[:t]
|
||||||
|
shortPath = string(util.FullPath(bucketAndObjectKey[t:]))
|
||||||
|
}
|
||||||
|
return bucket, shortPath
|
||||||
|
}
|
||||||
|
|
||||||
// get bucket collection from cache. if not exist, creates the buckets collection and grab it
|
// 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) {
|
func (store *ArangodbStore) ensureBucket(ctx context.Context, bucket string) (bc driver.Collection, err error) {
|
||||||
var ok bool
|
var ok bool
|
||||||
|
|
Loading…
Reference in a new issue