Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeType(r io.Reader) (string, error)
- func Encode(w io.Writer, o Object) error
- func IsSchema(p []byte) bool
- func MustTypeOf(o Object) string
- func PeekType(r io.Reader) (io.Reader, string, error)
- func RegisterName(name string, o Object)
- func TypeOf(o Object) (string, error)
- type BlobWrapper
- type Compressed
- type DirEntry
- type InlineList
- type List
- type Multipart
- type Object
- type Stats
- type TransformOp
- type WebContent
Constants ¶
const ( StatDataSize = "size" // size of all raw blobs (excluding the schema) StatDataCount = "cnt" // number of full objects (logical trees) )
const ( // MagicSize is a maximal size of a magic prefix of schema blobs. MagicSize = len(magic) )
Variables ¶
var ErrNotSchema = errors.New("not a schema file")
Functions ¶
func DecodeType ¶
DecodeType decodes the type of an object from the reader. Reader will not be usable after the call. See PeekType to reserve a reader in a usable state.
func IsSchema ¶
IsSchema checks if the buffer is likely to contain an object with a CAS schema. The buffer should be at least of MagicSize.
func MustTypeOf ¶
MustTypeOf is the same as TypeOf but panics on error.
func PeekType ¶
PeekType reads a portion of data from r, reports the type of the schema blob that it describes, and returns a new restored reader.
func RegisterName ¶
RegisterName associates a schema object with a given type name.
Types ¶
type BlobWrapper ¶
type Compressed ¶
type Compressed struct { Algo string `json:"algo"` Arch types.SizedRef `json:"arch"` Ref types.SizedRef `json:"ref"` }
func (*Compressed) References ¶
func (c *Compressed) References() []types.Ref
type DirEntry ¶
type DirEntry struct { Ref types.Ref `json:"ref"` Name string `json:"name"` Stats Stats `json:"stats"` }
func (*DirEntry) References ¶
type InlineList ¶
type InlineList struct { Ref *types.Ref `json:"ref,omitempty"` // ref of concatenated content, if applicable Elem string `json:"elem,omitempty"` // type of elements in List List []Object `json:"list,omitempty"` // Elem Stats Stats `json:"stats,omitempty"` // optional stats }
InlineList is an inlined list of entries of a specific type.
func (*InlineList) References ¶
func (l *InlineList) References() []types.Ref
func (*InlineList) UnmarshalJSON ¶
func (l *InlineList) UnmarshalJSON(p []byte) error
type List ¶
type List struct { Ref *types.Ref `json:"ref,omitempty"` // ref of concatenated content, if applicable Elem string `json:"elem,omitempty"` // type of elements in List List []types.Ref `json:"list,omitempty"` // List<Elem> or InlineList<Elem> Stats Stats `json:"stats,omitempty"` // optional stats }
List is an ordered list of entries of a specific type.
func (*List) References ¶
type Multipart ¶
type Multipart struct { Ref types.Ref `json:"ref,omitempty"` Parts []types.SizedRef `json:"parts"` }
func (*Multipart) References ¶
type Object ¶
Object is a generic schema object for CAS.
func Decode ¶
Decode decodes a schema object from a stream. It will strictly validate formatting of the content.
func DecodeJSON ¶
DecodeJSON decodes a JSON config. It will not validate JSON formatting as Decode does.
type TransformOp ¶
type TransformOp struct { Src types.Ref `json:"src"` Op types.Ref `json:"op"` Dst types.Ref `json:"dst"` }
func (*TransformOp) References ¶
func (t *TransformOp) References() []types.Ref
type WebContent ¶
type WebContent struct { URL string `json:"url"` Ref types.Ref `json:"ref"` Size uint64 `json:"size,omitempty"` ETag string `json:"etag,omitempty"` TS *time.Time `json:"ts,omitempty"` }
func (*WebContent) DataBlob ¶
func (c *WebContent) DataBlob() types.Ref
func (*WebContent) References ¶
func (c *WebContent) References() []types.Ref