Chris Lu
4 years ago
4 changed files with 64 additions and 80 deletions
-
5weed/filer/filerstore.go
-
43weed/filer/leveldb2/leveldb2_local_store.go
-
76weed/filer/meta_aggregator.go
-
20weed/server/filer_grpc_server_sub_meta.go
@ -1,43 +0,0 @@ |
|||||
package leveldb |
|
||||
|
|
||||
import ( |
|
||||
"fmt" |
|
||||
|
|
||||
"github.com/chrislusf/seaweedfs/weed/filer" |
|
||||
"github.com/chrislusf/seaweedfs/weed/util" |
|
||||
) |
|
||||
|
|
||||
var ( |
|
||||
_ = filer.FilerLocalStore(&LevelDB2Store{}) |
|
||||
) |
|
||||
|
|
||||
func (store *LevelDB2Store) UpdateOffset(filer string, lastTsNs int64) error { |
|
||||
|
|
||||
value := make([]byte, 8) |
|
||||
util.Uint64toBytes(value, uint64(lastTsNs)) |
|
||||
|
|
||||
err := store.dbs[0].Put([]byte("meta"+filer), value, nil) |
|
||||
|
|
||||
if err != nil { |
|
||||
return fmt.Errorf("UpdateOffset %s : %v", filer, err) |
|
||||
} |
|
||||
|
|
||||
println("UpdateOffset", filer, "lastTsNs", lastTsNs) |
|
||||
|
|
||||
return nil |
|
||||
} |
|
||||
|
|
||||
func (store *LevelDB2Store) ReadOffset(filer string) (lastTsNs int64, err error) { |
|
||||
|
|
||||
value, err := store.dbs[0].Get([]byte("meta"+filer), nil) |
|
||||
|
|
||||
if err != nil { |
|
||||
return 0, fmt.Errorf("ReadOffset %s : %v", filer, err) |
|
||||
} |
|
||||
|
|
||||
lastTsNs = int64(util.BytesToUint64(value)) |
|
||||
|
|
||||
println("ReadOffset", filer, "lastTsNs", lastTsNs) |
|
||||
|
|
||||
return |
|
||||
} |
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue