Documentation ¶
Overview ¶
Contains core types and logic pertaining to Hoard's backend storage services - but not the implementations of those stores to avoid a large number of possibly unwanted dependencies
Index ¶
- Constants
- func ErrorAddressNotFound(address []byte) error
- func MakeAddresser(hashProvider func() hash.Hash) func(data []byte) []byte
- func NewAddressEncoding(encodeToString func([]byte) string, decodeString func(string) ([]byte, error)) *addressEncoding
- func NewFileSystemStore(rootDirectory string, encoding AddressEncoding) (*fileSystemStore, error)
- func NewLoggingStore(store NamedStore, logger log.Logger) *loggingStore
- func NewMemoryStore() *memoryStore
- func NewSyncStore(store NamedStore) *syncStore
- func RunTests(t *testing.T, store Store)
- type AddressEncoding
- type ContentAddressedStore
- type Locator
- type NamedStore
- type ReadStore
- type StatInfo
- func (*StatInfo) Descriptor() ([]byte, []int)
- func (m *StatInfo) GetAddress() []byte
- func (m *StatInfo) GetExists() bool
- func (m *StatInfo) GetLocation() string
- func (m *StatInfo) GetSize_() uint64
- func (*StatInfo) ProtoMessage()
- func (m *StatInfo) Reset()
- func (m *StatInfo) String() string
- func (m *StatInfo) XXX_DiscardUnknown()
- func (m *StatInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *StatInfo) XXX_Merge(src proto.Message)
- func (m *StatInfo) XXX_Size() int
- func (m *StatInfo) XXX_Unmarshal(b []byte) error
- type Store
- type WriteStore
Constants ¶
const ( Base64EncodingName = "base64" Base32EncodingName = "base32" HexEncodingName = "hex" )
Variables ¶
This section is empty.
Functions ¶
func ErrorAddressNotFound ¶
func MakeAddresser ¶
Close in hasher
func NewAddressEncoding ¶
func NewFileSystemStore ¶
func NewFileSystemStore(rootDirectory string, encoding AddressEncoding) (*fileSystemStore, error)
func NewLoggingStore ¶
func NewLoggingStore(store NamedStore, logger log.Logger) *loggingStore
Decorates a Store with some simple logging of method/address pairs
func NewMemoryStore ¶
func NewMemoryStore() *memoryStore
func NewSyncStore ¶
func NewSyncStore(store NamedStore) *syncStore
Wrap a Store to synchronise it with respect to address access. For each address exactly one writer can enter the Put method of the underlying store or multiple readers can enter the Get and Stat methods, but no simultaneous readers (Getters, Statters) and writers (Putters) are allowed. Concurrent reads and writes to different addresses are permitted so the underlying store must be goroutine-safe across addresses.
Types ¶
type AddressEncoding ¶
type AddressEncoding interface { EncodeToString(address []byte) (addressString string) DecodeString(addressString string) (address []byte, err error) }
func GetAddressEncoding ¶
func GetAddressEncoding(name string) (AddressEncoding, error)
type ContentAddressedStore ¶
type ContentAddressedStore interface { ReadStore Locator // Put the data at its address Put(data []byte) (address []byte, err error) // Delete data from address Delete(address []byte) error // Get the address of some data without putting it at that address Address(data []byte) (address []byte) }
func NewContentAddressedStore ¶
func NewContentAddressedStore(addresser func([]byte) []byte, store Store) ContentAddressedStore
type NamedStore ¶
type StatInfo ¶
type StatInfo struct { // The address will be the same as the one passed in but is repeated to // make result self-describing Address []byte `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address,omitempty"` // If the blob does not exist this will be false instead of returning an // error Exists bool `protobuf:"varint,2,opt,name=Exists,proto3" json:"Exists,omitempty"` // Will be 0 if the blob does not existing (or omitted under protobuf3) Size_ uint64 `protobuf:"varint,3,opt,name=Size,proto3" json:"Size,omitempty"` // The externally resolvable location of the encrypted blob. The location // will be hypothetical if the blob does not exist Location string `protobuf:"bytes,4,opt,name=Location,proto3" json:"Location,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*StatInfo) Descriptor ¶
func (*StatInfo) GetAddress ¶
func (*StatInfo) GetLocation ¶
func (*StatInfo) ProtoMessage ¶
func (*StatInfo) ProtoMessage()
func (*StatInfo) XXX_DiscardUnknown ¶
func (m *StatInfo) XXX_DiscardUnknown()
func (*StatInfo) XXX_Marshal ¶
func (*StatInfo) XXX_Unmarshal ¶
type Store ¶
type Store interface { ReadStore WriteStore Locator }