filestore

package
v0.0.2-dev Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2016 License: Apache-2.0 Imports: 12 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 = "Stratumn 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 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/store.Adapter.

func New

func New(config *Config) *FileStore

New creates an instance of a FileStore.

func (*FileStore) DeleteSegment

func (a *FileStore) DeleteSegment(linkHash *types.Bytes32) (*cs.Segment, error)

DeleteSegment implements github.com/stratumn/go/store.Adapter.DeleteSegment.

func (*FileStore) FindSegments

func (a *FileStore) FindSegments(filter *store.Filter) (cs.SegmentSlice, error)

FindSegments implements github.com/stratumn/go/store.Adapter.FindSegments.

func (*FileStore) GetInfo

func (a *FileStore) GetInfo() (interface{}, error)

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

func (*FileStore) GetMapIDs

func (a *FileStore) GetMapIDs(pagination *store.Pagination) ([]string, error)

GetMapIDs implements github.com/stratumn/go/store.Adapter.GetMapIDs.

func (*FileStore) GetSegment

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

GetSegment implements github.com/stratumn/go/store.Adapter.GetSegment.

func (*FileStore) SaveSegment

func (a *FileStore) SaveSegment(segment *cs.Segment) error

SaveSegment implements github.com/stratumn/go/store.Adapter.SaveSegment.

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