buildstore

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2014 License: BSD-3-Clause, MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildDataDirName = ".srclib-cache"
View Source
var DataTypeNames = make(map[reflect.Type]string)
View Source
var DataTypes = make(map[string]interface{})

Functions

func BuildDir

func BuildDir(s *RepositoryStore, commitID string) (string, error)

func DataType

func DataType(filename string) (string, interface{})

DataType returns the data type name and empty instance (previously registered with RegisterDataType) to use for a build data file named filename. If no registered data type is found for filename, "" and nil are returned.

For example, if a data type "foo.v0" was registered, a filename of "qux_foo.v0.json" would return "foo.v0" and the registered type.

func DataTypeSuffix

func DataTypeSuffix(data interface{}) string

func RegisterDataType

func RegisterDataType(name string, emptyInstance interface{})

RegisterDataType makes a build data type available by the provided name.

When serializing build data of a certain type, the corresponding type name is included in the file basename. When deserializing build data from files, the file basename is parsed to determine the data type to deserialize into. For example, a data type with name "foo.v0" and type Foo{} would result in files named "whatever.foo.v0.json" being written, and those files would deserialize into Foo{} structs.

The name should contain a version identifier so that types may be modified more easily; for example, name could be "graph.v0" (and a subsequent version could be registered as "graph.v1" with a different struct).

The emptyInstance should be an zero value of the type (usually a nil pointer to a struct, or a nil slice or map) that holds the build data; it is used to instantiate instances dynamically.

If RegisterDataType is called twice with the same type or type name, if name is empty, or if emptyInstance is nil, it panics

func RootDir

func RootDir(s *RepositoryStore) (string, error)

RootDir returns the OS filesystem path that s's VFS is rooted at, if it is a local store (that uses the OS filesystem). If s is a non-OS-filesystem VFS, an error is returned.

Types

type BuildDataFileInfo

type BuildDataFileInfo struct {
	CommitID string
	Path     string
	Size     int64
	ModTime  time.Time
	DataType string
}

type MultiStore

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

func New

func New(fs rwvfs.FileSystem) *MultiStore

func (MultiStore) Join

func (_ MultiStore) Join(elem ...string) string

func (*MultiStore) RepositoryStore

func (s *MultiStore) RepositoryStore(repoURI repo.URI) (*RepositoryStore, error)

type RepositoryStore

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

func NewRepositoryStore

func NewRepositoryStore(repoDir string) (*RepositoryStore, error)

func (*RepositoryStore) AllDataFiles

func (s *RepositoryStore) AllDataFiles() ([]*BuildDataFileInfo, error)

func (*RepositoryStore) CommitPath

func (s *RepositoryStore) CommitPath(commitID string) string

func (*RepositoryStore) DataFiles

func (s *RepositoryStore) DataFiles(path string) ([]*BuildDataFileInfo, error)

func (*RepositoryStore) DataFilesForCommit

func (s *RepositoryStore) DataFilesForCommit(commitID string) ([]*BuildDataFileInfo, error)

func (*RepositoryStore) FilePath

func (s *RepositoryStore) FilePath(commitID, path string) string

func (RepositoryStore) Join

func (_ RepositoryStore) Join(elem ...string) string

func (*RepositoryStore) ListCommits

func (s *RepositoryStore) ListCommits() ([]string, error)

Jump to

Keyboard shortcuts

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