Documentation ¶
Overview ¶
* Copyright The Titan Project Contributors.
* Copyright The Titan Project Contributors.
* Copyright The Titan Project Contributors.
* Copyright The Titan Project Contributors.
Index ¶
- func Clear()
- func MatchTags(commit map[string]interface{}, query []Tag) bool
- func ParseURL(input string, properties map[string]string) (string, map[string]interface{}, []string, string, error)
- func Register(remote Remote)
- func Serve(remoteType string)
- func SortCommits(commits []Commit)
- func Unload(remoteType string)
- func ValidateFields(properties map[string]interface{}, required []string, optional []string) error
- type Commit
- type Remote
- type Tag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clear ¶
func Clear()
* Clear any registered or loaded remotes. Should only be used for testing.
func MatchTags ¶ added in v0.2.0
* Match a commit against a set of tags. Returns true if the commit matches the given tags, false otherwise.
func ParseURL ¶
func ParseURL(input string, properties map[string]string) (string, map[string]interface{}, []string, string, error)
* Wrap remote URL parsing in an easier-to use function that will handle converting to the intermediate URL format, * processing any query parameters (for tags) and fragment (for commit IDs).
func Register ¶
func Register(remote Remote)
* Register a new remote. This should be called from the init() function of a remote implementation. The remotes can * later be accessed via the Get() method.
func Serve ¶ added in v0.1.0
func Serve(remoteType string)
* Run the remote as a plugin server, to be invoked from the main method of the remote implementation.
func SortCommits ¶ added in v0.2.0
func SortCommits(commits []Commit)
*
- Sorts a list of commits in reverse descending order, based on timestamp.
Types ¶
type Remote ¶
type Remote interface { /* * Returns the canonical name of this provider, such as "ssh" or "s3". This must be globally unique, and must * match the leading URI component (ssh://...). */ Type() (string, error) /* * Parse a URL and return the provider-specific remote parameters in structured form. These properties will be * preserved as part of the remote metadata on the server and passed to subsequent server-side operations. The * additional properties map can contain properties specified by the user that don't fit the URI format well, * such as "-p keyFile=/path/to/sshKey". This should return an error for a bad URL format or invalid properties. * The calling context will have stripped out any query parameters or fragments. */ FromURL(url string, properties map[string]string) (map[string]interface{}, error) /* * Convert a remote back into URI form for display. Since this is for display only, any sensitive information * should be redacted (e.g. "user:****@host"). Any properties that cannot be represented in the URI can be * passed back as the second part of the pair. */ ToURL(properties map[string]interface{}) (string, map[string]string, error) /* * Given a set of remote properties, return a set of parameter properties that will be passed to each operation. * This is invoked in the context of the user CLI. It can access user data, such as SSH or AWS configuration. It * can also interactively prompt the user for additional input (such as a password). */ GetParameters(properties map[string]interface{}) (map[string]interface{}, error) /* * Validates the configuration of a remote, invoked by the server whenever a remote is passed as input or read * from the metadata store. This ensures that no malformed remotes are ever present. */ ValidateRemote(properties map[string]interface{}) error /* * Validates the configuration of remote parameters. */ ValidateParameters(parameters map[string]interface{}) error /* * Fetches a set of commits from the remote server. Commits are simply a tuple of (commitId, properties), with * some properties having semantic significance (namely timestamp and tags). The remote provider should always * return commits in reverse timestamp order, optionally filtered by the given tags. There are utility methods * in RemoteServerUtil if remotes don't provide this functionality server-side. Tags are specified as a list of * pairs, where the first element is always the key and the second is optionally the value. * * There is not yet support for pagination, though that will be added in the future to avoid having to fetch * the entire commit history every time. */ ListCommits(properties map[string]interface{}, parameters map[string]interface{}, tags []Tag) ([]Commit, error) /** * Fetches a single commit from the given remote. Returns nil if no such commit exists. */ GetCommit(properties map[string]interface{}, parameters map[string]interface{}, commitId string) (*Commit, error) }