shadows

package
v0.0.0-...-4450389 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2019 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package `shadows`: FSO shadow repos.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidGitFsoStatusOutput = errors.New(
	"invalid git-fso status output",
)
View Source
var ErrMalformedManifest = errors.New("malformed manifest")
View Source
var ErrMalformedTspath = errors.New("malformed tspath")
View Source
var ErrMissingNogtree = errors.New("missing `.nogtree`")

Functions

func ScanZero

func ScanZero(data []byte, atEOF bool) (advance int, token []byte, err error)

Base on `bufio.ScanLines()`.

Types

type Config

type Config struct {
	ShadowRoot             string
	ShadowRootAlternatives []string
	GitFsoProgram          string
	TrimHostRoot           string
	GitCommitter           User
}

type Filesystem

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

func New

func New(lg Logger, cfg Config) (*Filesystem, error)

func (*Filesystem) Archive

func (fs *Filesystem) Archive(shadowPath string, author User) error

func (*Filesystem) Content

func (fs *Filesystem) Content(
	ctx context.Context, shadowPath, contentPath string,
) (*pb.ContentO, error)

func (*Filesystem) GetTarttconfig

func (fs *Filesystem) GetTarttconfig(
	ctx context.Context,
	shadowPath string,
	gitCommit []byte,
) ([]byte, error)

func (*Filesystem) GitGc

func (fs *Filesystem) GitGc(ctx context.Context, shadowPath string) error

func (*Filesystem) Head

func (fs *Filesystem) Head(
	ctx context.Context, shadowPath string,
) (*pb.HeadO, error)

func (*Filesystem) Init

func (fs *Filesystem) Init(
	hostPath string, author User, repoId uuid.I, opts InitOptions,
) (*ShadowInfo, error)

func (*Filesystem) ListMetaTree

func (fs *Filesystem) ListMetaTree(
	ctx context.Context,
	shadowPath string,
	gitCommit []byte,
	callback ListMetaTreeFunc,
) error

func (*Filesystem) ListStatTree

func (fs *Filesystem) ListStatTree(
	ctx context.Context,
	shadowPath string,
	gitCommit []byte,
	prefix string,
	callback ListStatTreeFunc,
) error

func (*Filesystem) ListTars

func (fs *Filesystem) ListTars(
	ctx context.Context,
	shadowPath string,
	gitCommit []byte,
	callback ListTarsFunc,
) error

func (*Filesystem) Meta

func (fs *Filesystem) Meta(
	ctx context.Context, shadowPath string,
) (*pb.MetaO, error)

func (*Filesystem) Push

func (fs *Filesystem) Push(shadowPath string, remote string) error

func (*Filesystem) PutPathMetadata

func (fs *Filesystem) PutPathMetadata(
	ctx context.Context, shadowPath string, i *pb.PutPathMetadataI,
) (*pb.PutPathMetadataO, error)

func (*Filesystem) Ref

func (fs *Filesystem) Ref(shadowPath, ref string) (Oid, error)

func (*Filesystem) RefreshContent

func (fs *Filesystem) RefreshContent(shadowPath string, author User) error

func (*Filesystem) ReinitSubdirTracking

func (fs *Filesystem) ReinitSubdirTracking(
	shadowPath string, author User, subdirTracking SubdirTracking,
) error

func (*Filesystem) Sha

func (fs *Filesystem) Sha(shadowPath string, author User) error

func (*Filesystem) ShadowPath

func (fs *Filesystem) ShadowPath(hostPath string, repoId uuid.I) string

See NOE-18 for details. Mangle UUID into shadow path to allow nested repos, like:

``` real/foo/ real/foo/bar/

shadow/foo/<uuid>.fso/ shadow/foo/bar/<uuid>.fso/ ```

func (*Filesystem) Stat

func (fs *Filesystem) Stat(
	shadowPath string, author User, opts StatOptions,
) error

func (*Filesystem) StatStatus

func (fs *Filesystem) StatStatus(
	ctx context.Context,
	shadowPath string,
	callback StatStatusFunc,
) error

func (*Filesystem) Summary

func (fs *Filesystem) Summary(
	ctx context.Context, shadowPath string,
) (*pb.SummaryO, error)

func (*Filesystem) TarttHead

func (fs *Filesystem) TarttHead(
	ctx context.Context, shadowPath string,
) (*pb.TarttHeadO, error)

func (*Filesystem) TarttIsFrozenArchive

func (fs *Filesystem) TarttIsFrozenArchive(
	ctx context.Context, shadowPath string,
) (*TarttIsFrozenArchiveInfo, error)

type InitOptions

type InitOptions struct {
	SubdirTracking SubdirTracking
}

type ListMetaTreeFunc

type ListMetaTreeFunc func(info pb.PathMetadata) error

type ListStatTreeFunc

type ListStatTreeFunc func(info pb.PathInfo) error

type ListTarsFunc

type ListTarsFunc func(info pb.TarInfo) error

type Logger

type Logger interface {
	Infow(msg string, kv ...interface{})
}

type Oid

type Oid [20]byte

type ShadowInfo

type ShadowInfo struct {
	ShadowPath string
}

type StatOptions

type StatOptions struct {
	MtimeRangeOnly bool
}

type StatStatusFunc

type StatStatusFunc func(ps pb.PathStatus) error

type SubdirTracking

type SubdirTracking int
const (
	SubdirTrackingUnspecified SubdirTracking = iota
	EnterSubdirs
	BundleSubdirs
	IgnoreSubdirs
	IgnoreMost
)

type TarttIsFrozenArchiveInfo

type TarttIsFrozenArchiveInfo struct {
	IsFrozenArchive bool
	Reason          string

	StatAuthorName  string
	StatAuthorEmail string
	StatAuthorDate  time.Time
	Dirs            int64
	Files           int64
	FilesSize       int64
	Links           int64
	Others          int64
	MtimeMin        time.Time
	MtimeMax        time.Time

	TarPath string
	TarTime time.Time
}

type User

type User struct {
	Name  string
	Email string
}

Jump to

Keyboard shortcuts

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