workspace

package
v0.0.0-...-6b04d54 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REPO_KEY_PREFIX      = "repo:"
	DATA_REPO_KEY_PREFIX = "data:repo:"
	COMMIT_KEY_PREFIX    = "commit:"
	BRANCH_KEY_PREFIX    = "branch:"
	FILE_KEY_PREFIX      = "file:"
	UPDATE_OP            = "update"
	DELETE_OP            = "delete"
)
View Source
const (
	DefaultBranch = "master"
)

Variables

This section is empty.

Functions

func ListToD

func ListToD(paths []string) (map[string][]string, error)

func NewApiServer

func NewApiServer(db db_pkg.DatabaseContext, objAPI storage.ObjectAPIServer) (*apiServer, error)

func NewCommitTxn

func NewCommitTxn(repoName string, branchName string, commitId string, q *queryServer) (*commitTxn, error)

func NewQueryServer

func NewQueryServer(d db_pkg.DatabaseContext) *queryServer

Types

type ApiServer

type ApiServer interface {
	InitRepo(name string) (*RepoAttrs, error)
	InitTypedRepo(repoType RepoType, name string) (*RepoAttrs, error)
	RemoveRepo(name string) error

	CheckRepoExists(name string) bool
	InitBranch(repoName, branchName, head string) (*BranchAttrs, error)

	InitCommit(repoName, branchName, commitId string) (*CommitAttrs, error)
	StartCommit(repoName, branchName string) (*CommitAttrs, error)
	CloseCommit(repoName string, branchName string, commitId string) error

	GetModel(srcRepoName, srcBranchName, srcCommitId string) (*Repo, *Branch, *Commit, error)
	GetOrCreateModel(srcRepoName, srcBranchName, srcCommitId string) (*Repo, *Branch, *Commit, error)

	GetRepo(repoName string) (*Repo, error)
	GetRepoAttrs(repoName string) (*RepoAttrs, error)
	GetBranchAttrs(repoName string, branchName string) (*BranchAttrs, error)
	GetCommitAttrs(repoName string, commitId string) (*CommitAttrs, error)
	GetCommitAttrsByBranch(repoName, branchName string) (*CommitAttrs, error)
	GetCommitMap(repoName string, commitId string) (*FileMap, error)
	GetFileAttrs(repoName string, commitId string, filePath string) (*FileAttrs, error)

	GetCommitSize(repoName, branchName, commitId string) (int64, error)
	GetBranchSize(repoName, branchName string) (int64, error)

	ExplodeRepoAttrs(repoName, branchName, commitId string) (*RepoAttrs, *BranchAttrs, *CommitAttrs, *FileMap, error)
	ExplodeRepo(repoName, branchName string) (*Repo, *Branch, *Commit, error)

	PutFile(repoName string, branchName string, commitId string, fpath string, reader io.Reader) (*FileAttrs, int64, error)

	GetFileURL(repoId, commitId, filepath string) (string, error)
	PutFileURL(repoId, branchName, commitId, filepath string) (string, error)
	PutFilePartURL(partSeq int, repoId, branchName, commitId, filepath string) (string, error)

	CreateDataset(name string) (*RepoAttrs, error)

	FileCheckIn(repoId, branchName, commitId, filepath string, size int64, checksum string) (*FileAttrs, error)
	FileMergeAndCheckIn(repoId, branchName, commitId, filepath string, parts []int, size int64) (*FileAttrs, error)
}

type Branch

type Branch struct {
	Repo *Repo
	Name string
}

type BranchAttrs

type BranchAttrs struct {
	Branch *Branch
	Head   *Commit
}

maps branch to commits

type Commit

type Commit struct {
	Repo *Repo
	Id   string
}

func (*Commit) IsEqual

func (c *Commit) IsEqual(p *Commit) bool

type CommitAttrs

type CommitAttrs struct {
	Commit      *Commit
	Parent      *Commit
	Children    []*Commit
	Description string
	Size        int64
	Started     time.Time
	Finished    time.Time
}

func NewCommit

func NewCommit(repo *Repo, branch *Branch, parent *Commit) *CommitAttrs

func (*CommitAttrs) Id

func (ci *CommitAttrs) Id() string

func (*CommitAttrs) IsClosed

func (ci *CommitAttrs) IsClosed() bool

func (*CommitAttrs) IsNew

func (ci *CommitAttrs) IsNew() bool

func (*CommitAttrs) IsOpen

func (ci *CommitAttrs) IsOpen() bool

type CommitSizeRequest

type CommitSizeRequest struct {
	Repo     Repo
	Branch   Branch
	CommitId string
}

type CommitSizeResponse

type CommitSizeResponse struct {
	Size int64
}

type File

type File struct {
	Commit *Commit
	Path   string
}

type FileAttrs

type FileAttrs struct {
	File      *File
	FileType  string
	SizeBytes int64
	Object    *Object
	CheckSum  string
}

func NewDirInfo

func NewDirInfo(commit *Commit, dirPath string, sizeBytes int64) *FileAttrs

func NewFileAttrs

func NewFileAttrs(commit *Commit, filePath string, objectPath string, sizeBytes int64, checkSum string) *FileAttrs

func (*FileAttrs) GetObjectHash

func (f *FileAttrs) GetObjectHash() string

func (*FileAttrs) GetObjectPath

func (f *FileAttrs) GetObjectPath() string

func (*FileAttrs) Size

func (f *FileAttrs) Size() int64

type FileAttrsMap

type FileAttrsMap struct {
	Commit  *Commit
	Entries map[string]*FileAttrs
}

type FileAttrsMessage

type FileAttrsMessage struct {
	MessageType FileMessageType
	Repo        *Repo
	Branch      *Branch
	Commit      *Commit
	FileAttrs   *FileAttrs
	GetURL      string
	PutURL      string
}

type FileMap

type FileMap struct {
	Commit  *Commit
	Entries map[string]*File
	// contains filtered or unexported fields
}

func CopyFileMap

func CopyFileMap(commit *Commit, refMap FileMap) *FileMap

func NewFileMap

func NewFileMap(commit *Commit) *FileMap

func (*FileMap) Add

func (fm *FileMap) Add(file *File)

func (*FileMap) Count

func (fm *FileMap) Count() int

func (*FileMap) Filepaths

func (fm *FileMap) Filepaths(search_path string) (paths []string)

todo : add glob for search_path

func (*FileMap) GetFile

func (fm *FileMap) GetFile(path string) *File

func (*FileMap) Remove

func (fm *FileMap) Remove(file *File)

type FileMessage

type FileMessage struct {
	MessageType FileMessageType
	Repo        *Repo
	Branch      *Branch
	Commit      *Commit
	File        *File
	GetURL      string
	PutURL      string
}

type FileMessageType

type FileMessageType string
const (
	FileMessageURLGet  FileMessageType = "GET"
	FileMessageURLPut  FileMessageType = "PUT"
	FileMessageCheckIn FileMessageType = "CHECK_IN"
	FileMessagePut     FileMessageType = "PUT_FILE"
)

type FilePartMessage

type FilePartMessage struct {
	Seq         int
	MessageType FileMessageType
	File        *File
	FilePart    *Object
	Repo        *Repo
	Branch      *Branch
	Commit      *Commit
	GetURL      string
	PutURL      string
}

type FilePartsMessage

type FilePartsMessage struct {
	Sequences []int
	FileParts []Object
	File      *File
	Repo      *Repo
	Branch    *Branch
	Commit    *Commit
	FileAttrs *FileAttrs
}

type Object

type Object struct {
	Path     string
	Hash     string
	Size     int
	CheckSum string
	Parts    []string
}

type PutFileResponse

type PutFileResponse struct {
	FileAttrs *FileAttrs
	Written   int64
	Error     string
}

type Repo

type Repo struct {
	Name string
}

func NewRepo

func NewRepo(name string) *Repo

func RepoRef

func RepoRef(name string) *Repo

type RepoAttrs

type RepoAttrs struct {
	Repo        *Repo
	Type        RepoType
	Size_bytes  uint64
	Description string

	Branches map[string]*Branch
	Datasets map[string]*Repo
	// contains filtered or unexported fields
}

TODO: add created, updated etc

func (*RepoAttrs) AddBranch

func (ra *RepoAttrs) AddBranch(branch *Branch)

type RepoAttrsMessage

type RepoAttrsMessage struct {
	RepoAttrs   *RepoAttrs
	BranchAttrs *BranchAttrs
	CommitAttrs *CommitAttrs
	FileMap     *FileMap
}

type RepoMessage

type RepoMessage struct {
	Repo    *Repo
	Branch  *Branch
	Commit  *Commit
	FileMap *FileMap
}

type RepoType

type RepoType string
const (
	STANDARD_REPO RepoType = "STANDARD"
	DATASET_REPO  RepoType = "DATASET"
	MODEL_REPO    RepoType = "MODEL"
	OUTPUT_REPO   RepoType = "OUTPUT"
)

type StandardRepoMessage

type StandardRepoMessage struct {
	RepoMessage
	Output *RepoMessage
	Model  *RepoMessage
}

type StdRepoAttrsMessage

type StdRepoAttrsMessage struct {
	RepoAttrsMessage
	OutputAttrs *RepoAttrsMessage
	ModelAttrs  *RepoAttrsMessage
}

Jump to

Keyboard shortcuts

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