Documentation ¶
Index ¶
- type Core
- func (c *Core) BackwardsIterate(chunkIndex int, foreach func(key, value []byte) bool) error
- func (c *Core) CAS(key, value []byte, isSynced func(chunkIndex int) bool) error
- func (c *Core) ChunkSetNoPresent(cid int)
- func (c *Core) ChunkSetPresent(cid int)
- func (c *Core) ChunkSetProtected(cid int) error
- func (c *Core) Close()
- func (c *Core) Delete(key, value []byte) error
- func (lh *Core) Get(key []byte) ([]byte, error)
- func (c *Core) IsPresent(id int) bool
- func (c *Core) IsProtected(id int) bool
- func (c *Core) Iterate(chunkIndex int, foreach func(key, value []byte) bool) error
- func (c *Core) LengthOfChunk(chunkIndex int) uint64
- func (c *Core) Open()
- func (c *Core) PresentChunks() int
- func (c *Core) PresentChunksList() []protocol.AmAliveChunk
- func (c *Core) Set(key, value []byte) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
Core provides an interface to access local stored chunks
func New ¶
New creates a new server core instance dbpath is the path to store the DB, dbpath="" means RAM only chunkSize is the size in bytes of the chunk numChunks is the number of chunks of the DB Every chunk will be disabled (present flag = false)
func (*Core) BackwardsIterate ¶
Iterate all key-value pairs of a chunk in backwards direction, executing foreach for each key-value pair it will stop early if foreach returns false
func (*Core) CAS ¶
CAS makes an Compare And Swap operation isSynced should return true if the chunk is synced value uses a special convention, see package pmap
func (*Core) ChunkSetNoPresent ¶
ChunkSetNoPresent disables the present flag of a chunk
func (*Core) ChunkSetPresent ¶
ChunkSetPresent enables the present flag of a chunk
func (*Core) ChunkSetProtected ¶
ChunkSetProtected enables the protected flag of a chunk The flag will be disabled automatically after a period of time
func (*Core) IsProtected ¶
IsPresent returns true if the chunk is protected, false otherwise
func (*Core) Iterate ¶
Iterate all key-value pairs of a chunk, executing foreach for each key-value pair it will stop early if foreach returns false
func (*Core) LengthOfChunk ¶
LengthOfChunk returns the number of bytes used in the store, or math.MaxUint64 if the chunk isn't present
func (*Core) Open ¶
func (c *Core) Open()
Open will open an already stored DB, Open should be called after New
func (*Core) PresentChunks ¶
Returns the number of present chunks
func (*Core) PresentChunksList ¶
func (c *Core) PresentChunksList() []protocol.AmAliveChunk
Returns the list of present chunk IDs