Documentation ¶
Index ¶
- Constants
- Variables
- type Packet
- type Storage
- func (s *Storage) Close() error
- func (s *Storage) Delete(key []byte) error
- func (s *Storage) DetectAndFix() error
- func (s *Storage) Exists(key []byte) (bool, error)
- func (s *Storage) ForEach(fn func(*reader, *Packet, error) error) error
- func (s *Storage) Get(key []byte) ([]byte, error)
- func (s *Storage) GetByID(id uint64) (*Packet, error)
- func (s *Storage) Init() error
- func (s *Storage) Len() (int, error)
- func (s *Storage) PhysicalSnapshot(w io.Writer) error
- func (s *Storage) Set(key []byte, value []byte) error
Constants ¶
const ( // IDTypeTLV is the type of the ID TLV IDTypeTLV = byte(1) // OpTypeTLV is the type of the operation TLV. OpTypeTLV = byte(2) // KeyTypeTLV is the type of the key TLV. KeyTypeTLV = byte(3) // ValTypeTLV is the type of the value TLV. ValTypeTLV = byte(4) )
Variables ¶
var ( // Storage Ops SetOp = byte(1) DelOp = byte(2) )
Functions ¶
This section is empty.
Types ¶
type Packet ¶
type Packet struct { ID uint64 Op byte Key []byte Val []byte // contains filtered or unexported fields }
Packet is the basic unit of data transfer between the engine and the file system.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is a stupid storage.
func (*Storage) DetectAndFix ¶
DetectAndFix detects corrupt data in the store and tries to fix it
Note: DetectAndFix will remove the corrupt data from the store which means that some of the writes might vanish. But this is same because the storage engine provides guaranatees only in the cases when it is running in the sync mode and a response is sent back to the client indicating a success.
func (*Storage) ForEach ¶
ForEach goes through the entire store and executes the given function on each packet that it reads.
func (*Storage) GetByID ¶
GetByID returns a packet corresponding to the given ID.
This is a low level API and should not be used by the user.
func (*Storage) PhysicalSnapshot ¶
PhysicalSnapshot writes the current state of the storage to the given writer. The snapshot is written in a format that can be read by only by the storage.
Note: The DB is locked for writes while the snapshot is being generated.