Documentation ¶
Overview ¶
Package flatfs is a Datastore implementation that stores all objects in a two-level directory structure in the local file system, regardless of the hierarchy of the keys.
Package flatfs is a Datastore implementation that stores all objects in a two-level directory structure in the local file system, regardless of the hierarchy of the keys.
Index ¶
- Constants
- Variables
- 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
- func (fs *Datastore) Batch() (datastore.Batch, error)
- func (fs *Datastore) Close() error
- func (fs *Datastore) Delete(key datastore.Key) error
- func (fs *Datastore) Get(key datastore.Key) (value interface{}, err error)
- func (fs *Datastore) Has(key datastore.Key) (exists bool, err error)
- func (*Datastore) IsThreadSafe()
- func (fs *Datastore) Put(key datastore.Key, value interface{}) error
- func (fs *Datastore) Query(q query.Query) (query.Results, error)
- func (fs *Datastore) ShardStr() string
- type ShardFunc
- type ShardIdV1
Constants ¶
const PREFIX = "/repo/flatfs/shard/"
const README_FN = "_README"
const SHARDING_FN = "SHARDING"
const SyncThreadsMax = 16
don't block more than 16 threads on sync opearation 16 should be able to sataurate most RAIDs in case of two used disks per write (RAID 1, 5) and queue depth of 2, 16 concurrent Sync calls should be able to saturate 16 HDDs RAID TODO: benchmark it out, maybe provide tweak parmeter
Variables ¶
var ( ErrDatastoreExists = errors.New("datastore already exist") ErrDatastoreDoesNotExist = errors.New("datastore directory does not exist") ErrShardingFileMissing = fmt.Errorf("%s file not found in datastore", SHARDING_FN) )
var IPFS_DEF_SHARD = NextToLast(2)
var IPFS_DEF_SHARD_STR = IPFS_DEF_SHARD.String()
var README_IPFS_DEF_SHARD = `` /* 1121-byte string literal not displayed */
Functions ¶
func DirIsEmpty ¶
From: http://stackoverflow.com/questions/30697324/how-to-check-if-directory-on-path-is-empty
func DowngradeV1toV0 ¶
func UpgradeV0toV1 ¶
func WriteReadme ¶
func WriteShardFunc ¶
Types ¶
type Datastore ¶
type Datastore struct {
// contains filtered or unexported fields
}
func CreateOrOpen ¶
convenience method
func (*Datastore) IsThreadSafe ¶
func (*Datastore) IsThreadSafe()
type ShardIdV1 ¶
type ShardIdV1 struct {
// contains filtered or unexported fields
}