Documentation
¶
Overview ¶
Package filestore implements a store that saves all the segments to the file system.
The segments are stored as JSON files named after the link hashes. It's a convenient store to use during the development of an agent. However, because it doesn't use an index, it's very slow, and shouldn't be used for production.
Index ¶
- Constants
- type Batch
- type Config
- type FileStore
- func (a *FileStore) AddEvidence(ctx context.Context, linkHash chainscript.LinkHash, ...) error
- func (a *FileStore) AddStoreEventChannel(eventChan chan *store.Event)
- func (a *FileStore) CreateLink(ctx context.Context, link *chainscript.Link) (chainscript.LinkHash, error)
- func (a *FileStore) DeleteValue(ctx context.Context, key []byte) ([]byte, error)
- func (a *FileStore) FindSegments(ctx context.Context, filter *store.SegmentFilter) (*types.PaginatedSegments, error)
- func (a *FileStore) GetEvidences(ctx context.Context, linkHash chainscript.LinkHash) (types.EvidenceSlice, error)
- func (a *FileStore) GetInfo(ctx context.Context) (interface{}, error)
- func (a *FileStore) GetMapIDs(ctx context.Context, filter *store.MapFilter) ([]string, error)
- func (a *FileStore) GetSegment(ctx context.Context, linkHash chainscript.LinkHash) (*chainscript.Segment, error)
- func (a *FileStore) GetValue(ctx context.Context, key []byte) ([]byte, error)
- func (a *FileStore) NewBatch(ctx context.Context) (store.Batch, error)
- func (a *FileStore) SetValue(ctx context.Context, key []byte, value []byte) error
- type Info
Constants ¶
const ( // Name is the name set in the store's information. Name = "file" // Description is the description set in the store's information. Description = "Stratumn's File Store" // DefaultPath is the path where segments will be saved by default. DefaultPath = "/var/stratumn/filestore" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Batch ¶
type Batch struct { *bufferedbatch.Batch // contains filtered or unexported fields }
Batch is the type that implements github.com/stratumn/go-core/store.Batch.
type Config ¶
type Config struct { // A version string that will be set in the store's information. Version string // A git commit hash that will be set in the store's information. Commit string // Path where segments will be saved. Path string }
Config contains configuration options for the store.
type FileStore ¶
type FileStore struct {
// contains filtered or unexported fields
}
FileStore is the type that implements github.com/stratumn/go-core/store.Adapter.
func (*FileStore) AddEvidence ¶ added in v0.2.0
func (a *FileStore) AddEvidence(ctx context.Context, linkHash chainscript.LinkHash, evidence *chainscript.Evidence) error
AddEvidence implements github.com/stratumn/go-core/store.EvidenceWriter.AddEvidence.
func (*FileStore) AddStoreEventChannel ¶ added in v0.2.0
AddStoreEventChannel implements github.com/stratumn/go-core/store.Adapter.AddStoreEventChannel
func (*FileStore) CreateLink ¶ added in v0.2.0
func (a *FileStore) CreateLink(ctx context.Context, link *chainscript.Link) (chainscript.LinkHash, error)
CreateLink implements github.com/stratumn/go-core/store.LinkWriter.CreateLink.
func (*FileStore) DeleteValue ¶
DeleteValue implements github.com/stratumn/go-core/store.KeyValueStore.DeleteValue.
func (*FileStore) FindSegments ¶
func (a *FileStore) FindSegments(ctx context.Context, filter *store.SegmentFilter) (*types.PaginatedSegments, error)
FindSegments implements github.com/stratumn/go-core/store.SegmentReader.FindSegments.
func (*FileStore) GetEvidences ¶ added in v0.2.0
func (a *FileStore) GetEvidences(ctx context.Context, linkHash chainscript.LinkHash) (types.EvidenceSlice, error)
GetEvidences implements github.com/stratumn/go-core/store.EvidenceReader.GetEvidences.
func (*FileStore) GetMapIDs ¶
GetMapIDs implements github.com/stratumn/go-core/store.SegmentReader.GetMapIDs.
func (*FileStore) GetSegment ¶
func (a *FileStore) GetSegment(ctx context.Context, linkHash chainscript.LinkHash) (*chainscript.Segment, error)
GetSegment implements github.com/stratumn/go-core/store.SegmentReader.GetSegment.
func (*FileStore) GetValue ¶
GetValue implements github.com/stratumn/go-core/store.KeyValueStore.GetValue.