filestore

package
v0.0.0-...-4a8f785 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Overview

Package filestore implements the blob.Store interface using files. The store comprises a directory with subdirectories keyed by a prefix of the encoded blob key.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Opener

func Opener(_ context.Context, addr string) (blob.Store, error)

Opener constructs a filestore from an address comprising a path, for use with the store package.

Types

type Store

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

Store implements the blob.Store interface using a directory structure with one file per stored blob. Keys are encoded in hex and used to construct file and directory names relative to a root directory, similar to a Git local object store.

func New

func New(dir string) (*Store, error)

New creates a Store associated with the specified root directory, which is created if it does not already exist.

func (*Store) Delete

func (s *Store) Delete(_ context.Context, key string) error

Delete implements part of blob.Store.

func (*Store) Get

func (s *Store) Get(_ context.Context, key string) ([]byte, error)

Get implements part of blob.Store. It linearizes to the point at which opening the key path for reading returns.

func (*Store) Len

func (s *Store) Len(ctx context.Context) (int64, error)

Len implements part of blob.Store. It is implemented using List, so it linearizes in the same manner.

func (*Store) List

func (s *Store) List(_ context.Context, start string, f func(string) error) error

List implements part of blob.Store. If any concurrent Put operation on a key later than the current scan position succeeds, List linearizes immediately prior to the earliest such Put operation. Otherwise, List may be linearized to any point during its execution.

func (*Store) Put

func (s *Store) Put(_ context.Context, opts blob.PutOptions) error

Put implements part of blob.Store. A successful Put linearizes to the point at which the rename of the write temporary succeeds; a Put that fails due to an existing key linearizes to the point when the key path stat succeeds.

func (*Store) Size

func (s *Store) Size(_ context.Context, key string) (int64, error)

Size implements part of blob.Store. It linearizes to the point at which opening the key path succeeds.

Jump to

Keyboard shortcuts

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