filestore

package
v0.3.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

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

View Source
const (
	// Name is the name set in the store's information.
	Name = "file"

	// Description is the description set in the store's information.
	Description = "Indigo'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-indigocore/store.Batch.

func NewBatch

func NewBatch(ctx context.Context, a *FileStore) *Batch

NewBatch creates a new Batch

func (*Batch) Write

func (b *Batch) Write(ctx context.Context) (err error)

Write implements github.com/stratumn/go-indigocore/store.Batch.Write

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-indigocore/store.Adapter.

func New

func New(config *Config) (*FileStore, error)

New creates an instance of a FileStore.

func (*FileStore) AddEvidence added in v0.2.0

func (a *FileStore) AddEvidence(ctx context.Context, linkHash *types.Bytes32, evidence *cs.Evidence) error

AddEvidence implements github.com/stratumn/go-indigocore/store.EvidenceWriter.AddEvidence.

func (*FileStore) AddStoreEventChannel added in v0.2.0

func (a *FileStore) AddStoreEventChannel(eventChan chan *store.Event)

AddStoreEventChannel implements github.com/stratumn/go-indigocore/store.Adapter.AddStoreEventChannel

func (a *FileStore) CreateLink(ctx context.Context, link *cs.Link) (*types.Bytes32, error)

CreateLink implements github.com/stratumn/go-indigocore/store.LinkWriter.CreateLink.

func (*FileStore) DeleteValue

func (a *FileStore) DeleteValue(ctx context.Context, key []byte) ([]byte, error)

DeleteValue implements github.com/stratumn/go-indigocore/store.KeyValueStore.DeleteValue.

func (*FileStore) FindSegments

func (a *FileStore) FindSegments(ctx context.Context, filter *store.SegmentFilter) (cs.SegmentSlice, error)

FindSegments implements github.com/stratumn/go-indigocore/store.SegmentReader.FindSegments.

func (*FileStore) GetEvidences added in v0.2.0

func (a *FileStore) GetEvidences(ctx context.Context, linkHash *types.Bytes32) (*cs.Evidences, error)

GetEvidences implements github.com/stratumn/go-indigocore/store.EvidenceReader.GetEvidences.

func (*FileStore) GetInfo

func (a *FileStore) GetInfo(ctx context.Context) (interface{}, error)

GetInfo implements github.com/stratumn/go-indigocore/store.Adapter.GetInfo.

func (*FileStore) GetMapIDs

func (a *FileStore) GetMapIDs(ctx context.Context, filter *store.MapFilter) ([]string, error)

GetMapIDs implements github.com/stratumn/go-indigocore/store.SegmentReader.GetMapIDs.

func (*FileStore) GetSegment

func (a *FileStore) GetSegment(ctx context.Context, linkHash *types.Bytes32) (*cs.Segment, error)

GetSegment implements github.com/stratumn/go-indigocore/store.SegmentReader.GetSegment.

func (*FileStore) GetValue

func (a *FileStore) GetValue(ctx context.Context, key []byte) ([]byte, error)

GetValue implements github.com/stratumn/go-indigocore/store.KeyValueStore.GetValue.

func (*FileStore) NewBatch

func (a *FileStore) NewBatch(ctx context.Context) (store.Batch, error)

NewBatch implements github.com/stratumn/go-indigocore/store.Adapter.NewBatch.

func (*FileStore) SetValue added in v0.2.0

func (a *FileStore) SetValue(ctx context.Context, key []byte, value []byte) error

SetValue implements github.com/stratumn/go-indigocore/store.KeyValueStore.SetValue.

type Info

type Info struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Version     string `json:"version"`
	Commit      string `json:"commit"`
}

Info is the info returned by GetInfo.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL