gotrepo

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: GPL-3.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxBlobSize = gotfs.DefaultMaxBlobSize
	MaxCellSize = 1 << 16
)

Variables

This section is empty.

Functions

func Clone added in v0.0.3

func Clone(ctx context.Context, u goturl.SpaceURL, dirPath string) error

Clone creates a new Repo at dirPath with origin mapping to the space at URL.

func ConfigureRepo

func ConfigureRepo(repoPath string, fn func(x Config) Config) error

ConfigureRepo applies fn to the config of the repo at repoPath

func Init

func Init(p string) error

func LoadPrivateKey

func LoadPrivateKey(fsx posixfs.FS, p string) (p2p.PrivateKey, error)

func MarshalIAMPolicy

func MarshalIAMPolicy(p gotiam.Policy) []byte

func MarshalIAMRule

func MarshalIAMRule(r gotiam.Rule) []byte

func ParsePolicy

func ParsePolicy(data []byte) (*gotiam.Policy, error)

func ParseRule

func ParseRule(data []byte) (*gotiam.Rule, error)

func SaveConfig

func SaveConfig(fsx posixfs.FS, p string, c Config) error

func SavePrivateKey

func SavePrivateKey(fsx posixfs.FS, p string, privateKey p2p.PrivateKey) error

Types

type Branch

type Branch = branches.Branch

type BranchSpec

type BranchSpec struct {
	Volume      VolumeSpec            `json:"volume"`
	Salt        []byte                `json:"salt"`
	Annotations []branches.Annotation `json:"annotations"`
	CreatedAt   tai64.TAI64           `json:"created_at"`
}

type Cell

type Cell = cells.Cell

type CellID

type CellID = uint64

type CellSpec

type CellSpec struct {
	Local     *LocalCellSpec     `json:"local,omitempty"`
	HTTP      *HTTPCellSpec      `json:"http,omitempty"`
	Encrypted *EncryptedCellSpec `json:"encrypted,omitempty"`
	Signed    *SignedCellSpec    `json:"signed,omitempty"`
}

func ParseCellSpec

func ParseCellSpec(data []byte) (*CellSpec, error)

type Config

type Config struct {
	Spaces []SpaceLayerSpec `json:"spaces"`
}

func DefaultConfig

func DefaultConfig() Config

func LoadConfig

func LoadConfig(fsx posixfs.FS, p string) (*Config, error)

type CryptoSpaceSpec added in v0.0.3

type CryptoSpaceSpec struct {
	Inner  SpaceSpec `json:"inner"`
	Secret []byte    `json:"secret"`
}

type EncryptedCellSpec

type EncryptedCellSpec struct {
	Inner  CellSpec `json:"inner"`
	Secret []byte   `json:"secret"`
}

type FS

type FS = posixfs.FS

type FileOperation

type FileOperation struct {
	Create   *Root
	Modify   *Root
	Delete   bool
	MoveFrom *string
}

type GRPCSpaceSpec added in v0.0.3

type GRPCSpaceSpec struct {
	Endpoint string            `json:"endpoint"`
	Headers  map[string]string `json:"headers,omitempty"`
}

type HTTPCellSpec

type HTTPCellSpec = httpcell.Spec

type LocalCellSpec

type LocalCellSpec = CellID

type LocalStoreSpec

type LocalStoreSpec = StoreID

type MultiSpaceSpec

type MultiSpaceSpec []SpaceLayerSpec

type PeerCellSpec

type PeerCellSpec struct {
	ID   p2p.PeerID `json:"id"`
	Name string     `json:"name"`
}

type PeerID

type PeerID = inet256.Addr

type PrefixSpaceSpec added in v0.0.3

type PrefixSpaceSpec struct {
	Inner  SpaceSpec `json:"inner"`
	Prefix string    `json:"prefix"`
}

type PrivateKey

type PrivateKey = inet256.PrivateKey

type QUICSpaceSpec added in v0.0.3

type QUICSpaceSpec struct {
	ID   inet256.ID `json:"id"`
	Addr string     `json:"addr"`
}

type Ref

type Ref = gotkv.Ref

type Repo

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

func Open

func Open(p string) (*Repo, error)

func (*Repo) Add

func (r *Repo) Add(ctx context.Context, paths ...string) error

Add adds paths from the working directory to the staging area. Directories are traversed, and only paths are added. Adding a directory will update any existing paths and add new ones, it will not remove paths from version control

func (*Repo) Cat

func (r *Repo) Cat(ctx context.Context, p string, w io.Writer) error

func (*Repo) Check

func (r *Repo) Check(ctx context.Context) error

func (*Repo) CleanupBranch

func (r *Repo) CleanupBranch(ctx context.Context, name string) error

func (*Repo) Clear

func (r *Repo) Clear(ctx context.Context) error

Clear clears all entries from the staging area

func (*Repo) Close

func (r *Repo) Close() error

func (*Repo) Commit

func (r *Repo) Commit(ctx context.Context, snapInfo gotvc.SnapInfo) error

func (*Repo) CreateBranch

func (r *Repo) CreateBranch(ctx context.Context, name string, params branches.Metadata) (*Branch, error)

CreateBranch creates a branch using the default spec.

func (*Repo) CreateBranchWithSpec

func (r *Repo) CreateBranchWithSpec(name string, spec BranchSpec) (*Branch, error)

CreateBranchWithSpec creates a branch using spec

func (*Repo) DebugDB

func (r *Repo) DebugDB(ctx context.Context, w io.Writer) error

func (*Repo) DebugFS

func (r *Repo) DebugFS(ctx context.Context, w io.Writer) error

func (*Repo) DebugKV

func (r *Repo) DebugKV(ctx context.Context, w io.Writer) error

func (*Repo) DeleteBranch

func (r *Repo) DeleteBranch(ctx context.Context, name string) error

DeleteBranch deletes a branch

func (*Repo) Discard

func (r *Repo) Discard(ctx context.Context, paths ...string) error

Discard removes any staged changes for a path

func (*Repo) ForEachBranch

func (r *Repo) ForEachBranch(ctx context.Context, fn func(string) error) error

ForEachBranch calls fn once for each branch, or until an error is returned from fn

func (*Repo) ForEachStaging

func (r *Repo) ForEachStaging(ctx context.Context, fn func(p string, op FileOperation) error) error

func (*Repo) ForEachUntracked

func (r *Repo) ForEachUntracked(ctx context.Context, fn func(p string) error) error

ForEachUntracked lists all the files which are not in either:

  1. the staging area
  2. the active branch head

func (*Repo) Fork

func (r *Repo) Fork(ctx context.Context, base, next string) error

Fork creates a new branch called next and sets its head to match base's

func (*Repo) GetActiveBranch

func (r *Repo) GetActiveBranch(ctx context.Context) (string, *Branch, error)

GetActiveBranch returns the name of the active branch, and the branch

func (*Repo) GetBranch

func (r *Repo) GetBranch(ctx context.Context, name string) (*Branch, error)

GetBranch returns the branch with the specified name

func (*Repo) GetBranchHead

func (r *Repo) GetBranchHead(ctx context.Context, name string) (*Snap, error)

func (*Repo) GetIAMPolicy

func (r *Repo) GetIAMPolicy() gotiam.Policy

func (*Repo) GetID

func (r *Repo) GetID() inet256.Addr

func (*Repo) GetImportStores added in v0.0.3

func (r *Repo) GetImportStores(ctx context.Context, branchName string) (*branches.StoreTriple, error)

GetImportStores returns a store triple for importing the branch.

func (*Repo) GetNativeURL added in v0.0.3

func (r *Repo) GetNativeURL() goturl.SpaceURL

func (*Repo) GetPrivateKey

func (r *Repo) GetPrivateKey() p2p.PrivateKey

func (*Repo) GetSpace

func (r *Repo) GetSpace() Space

func (*Repo) GotNetClient

func (r *Repo) GotNetClient() (*gotnet.Service, error)

func (*Repo) History

func (r *Repo) History(ctx context.Context, name string, fn func(ref Ref, s Snap) error) error

func (*Repo) Ls

func (r *Repo) Ls(ctx context.Context, p string, fn func(gotfs.DirEnt) error) error

func (*Repo) MakeCell

func (r *Repo) MakeCell(spec CellSpec) (Cell, error)

func (*Repo) MakeSpace

func (r *Repo) MakeSpace(spec SpaceSpec) (Space, error)

func (*Repo) MakeStore

func (r *Repo) MakeStore(spec StoreSpec) (Store, error)

func (*Repo) MakeVolume

func (r *Repo) MakeVolume(spec VolumeSpec) (*Volume, error)

func (*Repo) Put

func (r *Repo) Put(ctx context.Context, paths ...string) error

Put replaces a path (file or directory) with whatever is in the working directory Adding a file updates the file. Adding a directory will delete paths not in the working directory, and add paths in the working directory.

func (*Repo) Rm

func (r *Repo) Rm(ctx context.Context, paths ...string) error

Rm deletes a path known to version control.

func (*Repo) Serve

func (r *Repo) Serve(ctx context.Context) error

Server serves cells, and blobs to the network.

func (*Repo) ServeQUIC added in v0.0.3

func (r *Repo) ServeQUIC(ctx context.Context, laddr string) error

func (*Repo) SetActiveBranch

func (r *Repo) SetActiveBranch(ctx context.Context, name string) error

SetActiveBranch sets the active branch to name

func (*Repo) SetBranch added in v0.0.3

func (r *Repo) SetBranch(ctx context.Context, name string, md branches.Metadata) error

SetBranch sets branch metadata

func (*Repo) SetBranchHead

func (r *Repo) SetBranchHead(ctx context.Context, name string, snap Snap) error

SetBranchHead

func (*Repo) Stat

func (r *Repo) Stat(ctx context.Context, p string) (*gotfs.Info, error)

func (*Repo) Sync

func (r *Repo) Sync(ctx context.Context, src, dst string, force bool) error

Sync synces 2 branches by name.

func (*Repo) UnionStore

func (r *Repo) UnionStore() cadata.Store

func (*Repo) UpdateIAMPolicy

func (r *Repo) UpdateIAMPolicy(fn func(gotiam.Policy) gotiam.Policy) error

func (*Repo) WorkingDir

func (r *Repo) WorkingDir() FS

type Root

type Root = gotfs.Root

type SignedCellSpec

type SignedCellSpec struct {
	Inner          CellSpec `json:"inner"`
	PublicKeyX509  []byte   `json:"public_key"`
	PrivateKeyX509 []byte   `json:"private_key"`
}

type Snap

type Snap = gotvc.Snap

type Space

type Space = branches.Space

type SpaceLayerSpec

type SpaceLayerSpec struct {
	Prefix string    `json:"prefix"`
	Target SpaceSpec `json:"target"`
}

type SpaceSpec

type SpaceSpec struct {
	Peer *inet256.ID    `json:"peer,omitempty"`
	QUIC *QUICSpaceSpec `json:"quic,omitempty"`
	GRPC *GRPCSpaceSpec `json:"grpc,omitempty"`

	Crypto *CryptoSpaceSpec `json:"crypto,omitempty"`
	Prefix *PrefixSpaceSpec `json:"prefix,omitempty"`
}

type Store

type Store = cadata.Store

type StoreID

type StoreID = uint64

type StoreSpec

type StoreSpec struct {
	Local *LocalStoreSpec `json:"local,omitempty"`
}

type Volume

type Volume = branches.Volume

type VolumeSpec

type VolumeSpec struct {
	Cell     CellSpec  `json:"cell"`
	VCStore  StoreSpec `json:"vc_store"`
	FSStore  StoreSpec `json:"fs_store"`
	RawStore StoreSpec `json:"raw_store"`
}

func ParseVolumeSpec

func ParseVolumeSpec(data []byte) (*VolumeSpec, error)

Jump to

Keyboard shortcuts

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