valuefile

package
v0.40.4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCorruptNVF = errors.New("nvf file is corrupt")

ErrCorruptNVF is the error used when the file being read is corrupt

Functions

func ReadFromReader

func ReadFromReader(ctx context.Context, rd io.Reader) ([]types.Value, error)

ReadFromReader reads from the provided reader which should provided access to data in the value file format and returns the values

func ReadValueFile

func ReadValueFile(ctx context.Context, filepath string) ([]types.Value, error)

ReadValueFile reads from the provided file and returns the values stored in the file

func WritePrimitiveValueFile

func WritePrimitiveValueFile(ctx context.Context, filepath string, values ...types.Value) error

WritePrimitiveValueFile writes values to the filepath provided

func WriteToWriter

func WriteToWriter(ctx context.Context, wr io.Writer, store *FileValueStore, values ...types.Value) error

WriteToWriter writes the values out to the provided writer in the value file format

func WriteValueFile

func WriteValueFile(ctx context.Context, filepath string, store *FileValueStore, values ...types.Value) (err error)

WriteValueFile writes the values stored in the *FileValueStore to the filepath provided

Types

type FileValueStore

type FileValueStore struct {
	// contains filtered or unexported fields
}

FileValueStore implements a trivial in memory chunks.ChunkStore and types.ValueReadWriter in order to allow easy serialization / deserialization of noms data to and from a file

func NewFileValueStore

func NewFileValueStore(nbf *types.NomsBinFormat) (*FileValueStore, error)

NewFileValueStore creates a new FileValueStore

func (*FileValueStore) Close

func (f *FileValueStore) Close() error

Close doesn't do anything

func (*FileValueStore) Commit

func (f *FileValueStore) Commit(ctx context.Context, current, last hash.Hash) (bool, error)

Commit sets the root hash

func (*FileValueStore) Format

func (f *FileValueStore) Format() *types.NomsBinFormat

Gets the NomsBinaryFormat for the Store

func (*FileValueStore) Get

Get gets a chunk by it's hash

func (*FileValueStore) GetMany

func (f *FileValueStore) GetMany(ctx context.Context, hashes hash.HashSet, found func(context.Context, *chunks.Chunk)) error

GetMany gets chunks by their hashes. Chunks that are found are written to the channel.

func (*FileValueStore) Has

func (f *FileValueStore) Has(ctx context.Context, h hash.Hash) (bool, error)

Has returns true if a chunk is present in the store, false if not

func (*FileValueStore) HasMany

func (f *FileValueStore) HasMany(ctx context.Context, hashes hash.HashSet) (absent hash.HashSet, err error)

HasMany returns the set of hashes that are absent from the store

func (*FileValueStore) Put

Put puts a chunk inton the store

func (*FileValueStore) ReadManyValues

func (f *FileValueStore) ReadManyValues(ctx context.Context, hashes hash.HashSlice) (types.ValueSlice, error)

ReadManyValues reads and decodes Values indicated by |hashes| from lvs and returns the found Values in the same order. Any non-present Values will be represented by nil.

func (*FileValueStore) ReadValue

func (f *FileValueStore) ReadValue(ctx context.Context, h hash.Hash) (types.Value, error)

ReadValue reads a value from the store

func (*FileValueStore) Rebase

func (f *FileValueStore) Rebase(ctx context.Context) error

Rebase brings this ChunkStore into sync with the persistent storage's current root. Has no impact here

func (*FileValueStore) Root

func (f *FileValueStore) Root(ctx context.Context) (hash.Hash, error)

Root returns the root hash

func (*FileValueStore) Stats

func (f *FileValueStore) Stats() interface{}

Stats doesn't do anything

func (*FileValueStore) StatsSummary

func (f *FileValueStore) StatsSummary() string

StatsSummary doesn't do anything

func (*FileValueStore) Version

func (f *FileValueStore) Version() string

Version returns the nbf version string

func (*FileValueStore) WriteValue

func (f *FileValueStore) WriteValue(ctx context.Context, v types.Value) (types.Ref, error)

WriteValue adds a value to the store

Jump to

Keyboard shortcuts

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