drive

package
v1.4.0-RC1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2017 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package drive provides the definitions for the low-level pfs storage drivers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPermissionError added in v1.1.0

func IsPermissionError(err error) bool

IsPermissionError returns true if a given error is a permission error.

func ValidateRepoName added in v1.3.19

func ValidateRepoName(name string) error

ValidateRepoName determines if a repo name is valid

Types

type CommitEvent added in v1.3.19

type CommitEvent struct {
	Err   error
	Value *pfs.CommitInfo
}

CommitEvent is an event that contains a CommitInfo or an error

type CommitStream added in v1.3.19

type CommitStream interface {
	Stream() <-chan CommitEvent
	Close()
}

CommitStream is a stream of CommitInfos

type Driver

type Driver interface {
	CreateRepo(ctx context.Context, repo *pfs.Repo, provenance []*pfs.Repo) error
	InspectRepo(ctx context.Context, repo *pfs.Repo) (*pfs.RepoInfo, error)
	ListRepo(ctx context.Context, provenance []*pfs.Repo) ([]*pfs.RepoInfo, error)
	DeleteRepo(ctx context.Context, repo *pfs.Repo, force bool) error

	StartCommit(ctx context.Context, parent *pfs.Commit, provenance []*pfs.Commit) (*pfs.Commit, error)
	BuildCommit(ctx context.Context, parent *pfs.Commit, provenance []*pfs.Commit, tree *pfs.Object) (*pfs.Commit, error)
	FinishCommit(ctx context.Context, commit *pfs.Commit) error
	InspectCommit(ctx context.Context, commit *pfs.Commit) (*pfs.CommitInfo, error)

	ListCommit(ctx context.Context, repo *pfs.Repo, from *pfs.Commit, to *pfs.Commit, number uint64) ([]*pfs.CommitInfo, error)
	SubscribeCommit(ctx context.Context, repo *pfs.Repo, branch string, from *pfs.Commit) (CommitStream, error)
	FlushCommit(ctx context.Context, fromCommits []*pfs.Commit, toRepos []*pfs.Repo) (CommitStream, error)
	DeleteCommit(ctx context.Context, commit *pfs.Commit) error

	ListBranch(ctx context.Context, repo *pfs.Repo) ([]*pfs.Branch, error)
	SetBranch(ctx context.Context, commit *pfs.Commit, name string) error
	DeleteBranch(ctx context.Context, repo *pfs.Repo, name string) error

	PutFile(ctx context.Context, file *pfs.File, delimiter pfs.Delimiter,
		targetFileDatums int64, targetFileBytes int64, reader io.Reader) error
	MakeDirectory(ctx context.Context, file *pfs.File) error
	GetFile(ctx context.Context, file *pfs.File, offset int64, size int64) (io.ReadCloser, error)
	InspectFile(ctx context.Context, file *pfs.File) (*pfs.FileInfo, error)
	ListFile(ctx context.Context, file *pfs.File) ([]*pfs.FileInfo, error)
	GlobFile(ctx context.Context, commit *pfs.Commit, pattern string) ([]*pfs.FileInfo, error)
	DeleteFile(ctx context.Context, file *pfs.File) error

	DeleteAll(ctx context.Context) error
	Dump(ctx context.Context)
}

Driver represents a low-level pfs storage driver.

func NewDriver

func NewDriver(address string, etcdAddresses []string, etcdPrefix string) (Driver, error)

NewDriver is used to create a new Driver instance

func NewLocalDriver added in v1.3.19

func NewLocalDriver(blockAddress string, etcdPrefix string) (Driver, error)

NewLocalDriver creates a driver using an local etcd instance. This function is intended for testing purposes

type ListFileMode added in v1.2.3

type ListFileMode int

ListFileMode specifies how ListFile executes.

const (
	// ListFileNORMAL computes sizes for files but not for directories
	ListFileNORMAL ListFileMode = iota
	// ListFileFAST does not compute sizes for files or directories
	ListFileFAST
	// ListFileRECURSE computes sizes for files and directories
	ListFileRECURSE
)

Jump to

Keyboard shortcuts

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