Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrExists = errors.New("File exists")
View Source
var ErrInvalidArgument = errors.New("Invalid argument")
View Source
var ErrNoSpace = errors.New("No more space")
Functions ¶
This section is empty.
Types ¶
type Segment ¶
type Segment interface {
//Returns the address of the first free word in the segment when it was locked
BaseAddress() uint64
//Unlocks the segment for the StorageProvider to give to other consumers
//Implies a flush
Unlock()
//Writes a slice to the segment, returns immediately
//Returns nil if op is OK, otherwise ErrNoSpace or ErrInvalidArgument
//It is up to the implementer to work out how to report no space immediately
//The uint64 is the address to be used for the next write
Write(uuid []byte, address uint64, data []byte) (uint64, error)
//Block until all writes are complete. Note this does not imply a flush of the underlying files.
Flush()
}
type StorageProvider ¶
type StorageProvider interface {
//Called at startup of a normal run
Initialize(opts map[string]string)
//Called to create the database for the first time
//Note that initialize is not called before this function call
//and you can assume the program will exit shortly after this
//function call
CreateDatabase(opts map[string]string) error
// Lock a segment, or block until a segment can be locked
// Returns a Segment struct
LockSegment(uuid []byte) Segment
// Read the blob into the given buffer
Read(uuid []byte, address uint64, buffer []byte) []byte
}
Click to show internal directories.
Click to hide internal directories.