only store the blobs in the underlying storage if LFUDA accepted them
This commit is contained in:
parent
ff9b61b034
commit
9fc96ac01b
1 changed files with 7 additions and 4 deletions
|
@ -66,11 +66,14 @@ func (l *LFUDAStore) Get(hash string) (stream.Blob, error) {
|
||||||
|
|
||||||
// Put stores the blob. Following LFUDA rules it's not guaranteed that a SET will store the value!!!
|
// Put stores the blob. Following LFUDA rules it's not guaranteed that a SET will store the value!!!
|
||||||
func (l *LFUDAStore) Put(hash string, blob stream.Blob) error {
|
func (l *LFUDAStore) Put(hash string, blob stream.Blob) error {
|
||||||
|
l.lfuda.Set(hash, fakeTrue)
|
||||||
|
has, _ := l.Has(hash)
|
||||||
|
if has {
|
||||||
err := l.store.Put(hash, blob)
|
err := l.store.Put(hash, blob)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
l.lfuda.Set(hash, fakeTrue)
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue