Documentation ¶
Index ¶
- Variables
- func BuildDir(s *RepositoryStore, commitID string) (string, error)
- func DataType(filename string) (string, interface{})
- func DataTypeSuffix(data interface{}) string
- func RegisterDataType(name string, emptyInstance interface{})
- func RootDir(s *RepositoryStore) (string, error)
- type BuildDataFileInfo
- type MultiStore
- type RepositoryStore
- func (s *RepositoryStore) AllDataFiles() ([]*BuildDataFileInfo, error)
- func (s *RepositoryStore) CommitPath(commitID string) string
- func (s *RepositoryStore) DataFiles(path string) ([]*BuildDataFileInfo, error)
- func (s *RepositoryStore) DataFilesForCommit(commitID string) ([]*BuildDataFileInfo, error)
- func (s *RepositoryStore) FilePath(commitID, path string) string
- func (_ RepositoryStore) Join(elem ...string) string
- func (s *RepositoryStore) ListCommits() ([]string, error)
Constants ¶
This section is empty.
Variables ¶
var BuildDataDirName = ".srclib-cache"
var DataTypeNames = make(map[reflect.Type]string)
var DataTypes = make(map[string]interface{})
Functions ¶
func DataType ¶
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 MultiStore ¶
type MultiStore struct {
// contains filtered or unexported fields
}
func New ¶
func New(fs rwvfs.FileSystem) *MultiStore
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) ListCommits ¶
func (s *RepositoryStore) ListCommits() ([]string, error)