mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
zz
This commit is contained in:
parent
2f0cdcdceb
commit
171c27ddf1
|
@ -33,6 +33,7 @@ type Model struct {
|
|||
Directory string `json:"directory,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Bucket string `json:"bucket,omitempty"`
|
||||
Ttl string `json:"ttl,omitempty"`
|
||||
|
||||
//arangodb does not support binary blobs
|
||||
//we encode byte slice into uint64 slice
|
||||
|
@ -108,10 +109,15 @@ func (store *ArangodbStore) connection(uris []string, user string, pass string,
|
|||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, _, err = store.collection.EnsurePersistentIndex(ctx, []string{"directory"},
|
||||
&driver.EnsurePersistentIndexOptions{Name: "IDX_directory"}); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, _, err = store.collection.EnsureTTLIndex(ctx, "ttl", 1,
|
||||
&driver.EnsureTTLIndexOptions{Name: "IDX_TTL"}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, _, err = store.collection.EnsurePersistentIndex(ctx, []string{"name"}, &driver.EnsurePersistentIndexOptions{
|
||||
Name: "IDX_name",
|
||||
|
@ -188,6 +194,11 @@ func (store *ArangodbStore) InsertEntry(ctx context.Context, entry *filer.Entry)
|
|||
Meta: bytesToArray(meta),
|
||||
Bucket: bucket,
|
||||
}
|
||||
if entry.TtlSec > 0 {
|
||||
model.Ttl = time.Now().Add(time.Second * time.Duration(entry.TtlSec)).Format(time.RFC3339)
|
||||
} else {
|
||||
model.Ttl = ""
|
||||
}
|
||||
_, err = store.collection.CreateDocument(ctx, model)
|
||||
if driver.IsConflict(err) {
|
||||
return store.UpdateEntry(ctx, entry)
|
||||
|
@ -231,6 +242,11 @@ func (store *ArangodbStore) UpdateEntry(ctx context.Context, entry *filer.Entry)
|
|||
Name: name,
|
||||
Meta: bytesToArray(meta),
|
||||
}
|
||||
if entry.TtlSec > 0 {
|
||||
model.Ttl = time.Now().Add(time.Duration(entry.TtlSec) * time.Second).Format(time.RFC3339)
|
||||
} else {
|
||||
model.Ttl = "none"
|
||||
}
|
||||
|
||||
_, err = store.collection.UpdateDocument(ctx, model.Key, model)
|
||||
|
||||
|
|
|
@ -43,6 +43,5 @@ should there be one collection per bucket? would make deleting a bucket instant
|
|||
|
||||
arangodb uses rocksdb in the background, so i am assuming things run in log time
|
||||
|
||||
single document retreval might run in constant time
|
||||
|
||||
i am not sure how the prefix query scales compared to the recursive calls that some other stores do for folder deletion
|
||||
might need to change that
|
||||
|
|
Loading…
Reference in a new issue