Versions in this module Expand all Collapse all v0 v0.0.2 Aug 21, 2021 Changes in this version + const PREFIX + const README_FN + const SHARDING_FN + const SyncThreadsMax + var DMS3_DEF_SHARD = NextToLast(2) + var DMS3_DEF_SHARD_STR = DMS3_DEF_SHARD.String() + var DiskUsageCalcTimeout = 5 * time.Minute + var DiskUsageFile = "diskUsage.cache" + var DiskUsageFilesAverage = 2000 + var ErrClosed = errors.New("datastore closed") + var ErrDatastoreDoesNotExist = errors.New("datastore directory does not exist") + var ErrDatastoreExists = errors.New("datastore already exists") + var ErrInvalidKey = errors.New("key not supported by flatfs") + var ErrShardingFileMissing = fmt.Errorf("%s file not found in datastore", SHARDING_FN) + var README_DMS3_DEF_SHARD = ... + var RetryAttempts = 6 + var RetryDelay = time.Millisecond * 200 + func Create(path string, fun *ShardIdV1) error + func DirIsEmpty(name string) (bool, error) + func DowngradeV1toV0(path string) error + func Move(oldPath string, newPath string, out io.Writer) error + func UpgradeV0toV1(path string, prefixLen int) error + func WriteReadme(dir string, id *ShardIdV1) error + func WriteShardFunc(dir string, id *ShardIdV1) error + type Datastore struct + func CreateOrOpen(path string, fun *ShardIdV1, sync bool) (*Datastore, error) + func Open(path string, syncFiles bool) (*Datastore, error) + func (fs *Datastore) Accuracy() string + func (fs *Datastore) Batch() (datastore.Batch, error) + func (fs *Datastore) Close() error + func (fs *Datastore) Delete(key datastore.Key) error + func (fs *Datastore) DiskUsage() (uint64, error) + func (fs *Datastore) Get(key datastore.Key) (value []byte, err error) + func (fs *Datastore) GetSize(key datastore.Key) (size int, err error) + func (fs *Datastore) Has(key datastore.Key) (exists bool, err error) + func (fs *Datastore) Put(key datastore.Key, value []byte) error + func (fs *Datastore) Query(q query.Query) (query.Results, error) + func (fs *Datastore) ShardStr() string + func (fs *Datastore) Sync(prefix datastore.Key) error + type ShardFunc func(string) string + type ShardIdV1 struct + func NextToLast(suffixLen int) *ShardIdV1 + func ParseShardFunc(str string) (*ShardIdV1, error) + func Prefix(prefixLen int) *ShardIdV1 + func ReadShardFunc(dir string) (*ShardIdV1, error) + func Suffix(suffixLen int) *ShardIdV1 + func (f *ShardIdV1) Func() ShardFunc + func (f *ShardIdV1) String() string