Documentation ¶
Index ¶
- Constants
- func IsRef(s string) bool
- type Pin
- type Ref
- func (r Ref) Data() []byte
- func (r Ref) Empty() bool
- func (r Ref) GoString() string
- func (r Ref) Hash() hash.Hash
- func (r Ref) MarshalText() ([]byte, error)
- func (r Ref) Name() string
- func (r Ref) String() string
- func (r *Ref) UnmarshalText(s []byte) error
- func (r Ref) WithHash(h hash.Hash) Ref
- func (r Ref) Zero() bool
- type SchemaRef
- type SizedRef
Constants ¶
const (
DefaultHash = hashSha256Name
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Pin ¶
Pin is a named reference to a blob.
func (*Pin) References ¶
References implements schema.Object interface.
type Ref ¶
type Ref struct {
// contains filtered or unexported fields
}
Ref is a reference to a blob in content-addressable storage. It consists of a hash type and the hash data. Refs are comparable.
func MustParseRef ¶
MustParseRef is the same as ParseRef, but panics on error.
func NewRef ¶
func NewRef() Ref
NewRef creates a new zero ref with a default hash function.
Example:
ref := NewRef() h := ref.Hash() h.Write(p) ref = ref.WithHash(h)
func ParseRefBytes ¶
ParseRef parses byte slice as a string representation of a Ref.
func (Ref) GoString ¶
GoString returns a ref representation suitable for the use in the Go source code.
func (Ref) Hash ¶
Hash initializes a new hash to populate the ref.
Example:
h := ref.Hash() h.Write(p) ref = ref.WithHash(h)
func (Ref) MarshalText ¶
MarshalText implements encoding.TextMarshaler interface.
func (*Ref) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler interface.
type SchemaRef ¶
type SchemaRef struct { Ref Ref `json:"ref"` Size uint64 `json:"size,omitempty"` Type string `json:"type,omitempty"` }
SchemaRef is a reference that describes a schema object. It stores the size of a schema object in bytes and the type of an object.
func (*SchemaRef) References ¶
References implements schema.Object interface.
type SizedRef ¶
SizedRef is a object that combines a Ref and a size of a blob that it describes.
func (*SizedRef) References ¶
References implements schema.Object interface.