staging

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Operation

type Operation struct {
	Delete bool        `json:"del,omitempty"`
	Put    *gotfs.Root `json:"put,omitempty"`
}

type Stage

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

func New

func New(stor Storage) *Stage

func (*Stage) Apply

func (s *Stage) Apply(ctx context.Context, fsop *gotfs.Operator, ms, ds cadata.Store, base *gotfs.Root) (*gotfs.Root, error)

func (*Stage) CheckConflict

func (s *Stage) CheckConflict(ctx context.Context, p string) error

func (*Stage) Delete

func (s *Stage) Delete(ctx context.Context, p string) error

Delete removes a file at p with root

func (*Stage) Discard

func (s *Stage) Discard(ctx context.Context, p string) error

func (*Stage) ForEach

func (s *Stage) ForEach(ctx context.Context, fn func(p string, op Operation) error) error

func (*Stage) Get

func (s *Stage) Get(ctx context.Context, p string) (*Operation, error)

Get returns the operation, if any, staged for the path p If there is no operation staged Get returns (nil, nil)

func (*Stage) IsEmpty

func (s *Stage) IsEmpty(ctx context.Context) (bool, error)

func (*Stage) Put

func (s *Stage) Put(ctx context.Context, p string, root gotfs.Root) error

Put replaces a path at p with root

func (*Stage) Reset

func (s *Stage) Reset() error

type Storage

type Storage interface {
	Put(k, v []byte) error
	Get(k []byte) ([]byte, error)
	Delete(k []byte) error
	ForEach(fn func(k, v []byte) error) error
	DeleteAll() error
}

func NewBoltStorage

func NewBoltStorage(db *bolt.DB, bucket string) Storage

Jump to

Keyboard shortcuts

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