ondisk

package
v1.10.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package ondisk implements an encrypted on-disk storage backend with integrated revision control as well as automatic synchronization (soon).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OnDisk

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

OnDisk is an on disk key-value store

func New

func New(ctx context.Context, baseDir string) (*OnDisk, error)

New creates a new ondisk store

func (*OnDisk) Add

func (o *OnDisk) Add(ctx context.Context, args ...string) error

Add is not supported / necessary

func (*OnDisk) AddRemote

func (o *OnDisk) AddRemote(ctx context.Context, _, location string) error

AddRemote sets the remote

func (*OnDisk) Commit

func (o *OnDisk) Commit(ctx context.Context, msg string) error

Commit is not supported / necessary

func (*OnDisk) Compact

func (o *OnDisk) Compact(ctx context.Context) error

Compact will prune all deleted entries and truncate every other entry to the last 10 revisions.

func (*OnDisk) Delete

func (o *OnDisk) Delete(ctx context.Context, name string) error

Delete removes an entry

func (*OnDisk) Exists

func (o *OnDisk) Exists(ctx context.Context, name string) bool

Exists checks if an entry exists

func (*OnDisk) Fsck

func (o *OnDisk) Fsck(ctx context.Context) error

Fsck checks store integrity and performs a compaction

func (*OnDisk) Get

func (o *OnDisk) Get(ctx context.Context, name string) ([]byte, error)

Get returns an entry

func (*OnDisk) GetRemote

func (o *OnDisk) GetRemote(ctx context.Context) (*RemoteConfig, error)

GetRemote reads the remote config from disk

func (*OnDisk) GetRevision

func (o *OnDisk) GetRevision(ctx context.Context, name, revision string) ([]byte, error)

GetRevision returns a single revision

func (*OnDisk) InitConfig

func (o *OnDisk) InitConfig(ctx context.Context, name, email string) error

InitConfig is not necessary

func (*OnDisk) IsDir

func (o *OnDisk) IsDir(ctx context.Context, name string) bool

IsDir is not supported

func (*OnDisk) List

func (o *OnDisk) List(ctx context.Context, prefix string) ([]string, error)

List lists all entries

func (*OnDisk) Name

func (o *OnDisk) Name() string

Name returns ondisk

func (*OnDisk) Path

func (o *OnDisk) Path() string

Path returns the on disk path

func (*OnDisk) Prune

func (o *OnDisk) Prune(ctx context.Context, prefix string) error

Prune removes all entries with a given prefix

func (*OnDisk) Pull

func (o *OnDisk) Pull(ctx context.Context, remote, location string) error

Pull fetches the index from the remote but does not upload it.

func (*OnDisk) Push

func (o *OnDisk) Push(ctx context.Context, remote, location string) error

Push fetches the index from the remote, merges it and uploads the result

func (*OnDisk) RemoveRemote

func (o *OnDisk) RemoveRemote(ctx context.Context, _ string) error

RemoveRemote removes the remote

func (*OnDisk) Revisions

func (o *OnDisk) Revisions(ctx context.Context, name string) ([]backend.Revision, error)

Revisions returns a list of revisions for this entry

func (*OnDisk) Set

func (o *OnDisk) Set(ctx context.Context, name string, value []byte) error

Set creates a new revision for an entry

func (*OnDisk) SetRemote

func (o *OnDisk) SetRemote(ctx context.Context, urlStr string) error

SetRemote updates the remote config for this store

func (*OnDisk) Status

func (o *OnDisk) Status(ctx context.Context) ([]byte, error)

Status is not necessary

func (*OnDisk) String

func (o *OnDisk) String() string

String returns the name and path

func (*OnDisk) Version

func (o *OnDisk) Version(context.Context) semver.Version

Version returns 1.0.0

type RemoteConfig

type RemoteConfig struct {
	SSL    bool   `json:"ssl"`
	KeyID  string `json:"key"`
	Secret string `json:"secret"`
	Host   string `json:"host"`
	Bucket string `json:"bucket"`
	Prefix string `json:"prefix"`
}

RemoteConfig is a remote config

func (*RemoteConfig) String

func (r *RemoteConfig) String() string

String implements fmt.Stringer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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