Documentation ¶
Index ¶
- func StatusWrap(err error, msg string) error
- func StatusWrapWithCode(err error, code codes.Code, msg string) error
- func StatusWrapf(err error, format string, args ...interface{}) error
- func StatusWrapfWithCode(err error, code codes.Code, format string, args ...interface{}) error
- func UnmarshalConfigurationFromFile(path string, configuration proto.Message) error
- type Digest
- func (d *Digest) GetHashBytes() []byte
- func (d *Digest) GetHashString() string
- func (d *Digest) GetInstance() string
- func (d *Digest) GetKey(format DigestKeyFormat) string
- func (d *Digest) GetPartialDigest() *remoteexecution.Digest
- func (d *Digest) GetSizeBytes() int64
- func (d *Digest) NewDerivedDigest(partialDigest *remoteexecution.Digest) (*Digest, error)
- func (d *Digest) NewDigestGenerator() *DigestGenerator
- func (d *Digest) NewHasher() hash.Hash
- func (d *Digest) String() string
- type DigestGenerator
- type DigestKeyFormat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StatusWrap ¶
StatusWrap prepends a string to the message of an existing error.
func StatusWrapWithCode ¶
StatusWrapWithCode prepends a string to the message of an existing error, while replacing the error code.
func StatusWrapf ¶
StatusWrapf prepends a formatted string to the message of an existing error.
func StatusWrapfWithCode ¶
StatusWrapfWithCode prepends a formatted string to the message of an existing error, while replacing the error code.
Types ¶
type Digest ¶
type Digest struct {
// contains filtered or unexported fields
}
Digest holds the identification of an object stored in the Content Addressable Storage (CAS) or Action Cache (AC). The use of this object is preferred over remoteexecution.Digest for a couple of reasons.
- Instances of these objects are guaranteed not to contain any degenerate values. The hash has already been decoded from hexadecimal to binary. The size is non-negative.
- They keep track of the instance as part of the digest, which allows us to keep function signatures across the codebase simple.
- They provide utility functions for deriving new digests from them. This ensures that outputs of build actions automatically use the same instance name and hashing algorithm.
func MustNewDigest ¶
func MustNewDigest(instance string, partialDigest *remoteexecution.Digest) *Digest
MustNewDigest constructs a Digest similar to NewDigest, but never returns an error. Instead, execution will abort if the resulting instance would be degenerate. Useful for unit testing.
func NewDigest ¶
func NewDigest(instance string, partialDigest *remoteexecution.Digest) (*Digest, error)
NewDigest constructs a Digest object from an instance name and a protocol-level digest object. The instance returned by this function is guaranteed to be non-degenerate.
func NewDigestFromBytestreamPath ¶
NewDigestFromBytestreamPath creates a Digest from a string having one of the following two formats:
- blobs/${hash}/${size} - ${instance}/blobs/${hash}/${size}
This notation is used by Bazel to refer to files accessible through a gRPC Bytestream service.
func (*Digest) GetHashBytes ¶
GetHashBytes returns the hash of the object as a slice of bytes.
func (*Digest) GetHashString ¶
GetHashString returns the hash of the object as a string.
func (*Digest) GetInstance ¶
GetInstance returns the instance name of the object.
func (*Digest) GetKey ¶
func (d *Digest) GetKey(format DigestKeyFormat) string
GetKey generates a string representation of the digest object that may be used as keys in hash tables.
func (*Digest) GetPartialDigest ¶
func (d *Digest) GetPartialDigest() *remoteexecution.Digest
GetPartialDigest encodes the digest into the format used by the remote execution protocol, so that it may be stored in messages returned to the client.
func (*Digest) GetSizeBytes ¶
GetSizeBytes returns the size of the object, in bytes.
func (*Digest) NewDerivedDigest ¶
func (d *Digest) NewDerivedDigest(partialDigest *remoteexecution.Digest) (*Digest, error)
NewDerivedDigest creates a Digest object that uses the same instance name as the one from which it is derived. This can be used to refer to inputs (command, directories, files) of an action.
func (*Digest) NewDigestGenerator ¶
func (d *Digest) NewDigestGenerator() *DigestGenerator
NewDigestGenerator creates a writer that may be used to compute digests of newly created files.
type DigestGenerator ¶
type DigestGenerator struct {
// contains filtered or unexported fields
}
DigestGenerator is a writer that may be used to compute digests of newly created files.
func (*DigestGenerator) Sum ¶
func (dg *DigestGenerator) Sum() *Digest
Sum creates a new digest based on the data written into the DigestGenerator.
type DigestKeyFormat ¶
type DigestKeyFormat int
DigestKeyFormat is an enumeration type that determines the format of object keys returned by Digest.GetKey().
const ( // DigestKeyWithoutInstance lets Digest.GetKey() return a key // that does not include the name of the instance; only the hash // and the size. DigestKeyWithoutInstance DigestKeyFormat = iota // DigestKeyWithInstance lets Digest.GetKey() return a key // that includes the hash, size and instance name. DigestKeyWithInstance )