Documentation ¶
Index ¶
- Constants
- Variables
- func EncodeValue(v Value, vw ValueWriter) chunks.Chunk
- func EncodedIndexValue(v Value) string
- func EncodedValue(v Value) string
- func EncodedValueWithTags(v Value) string
- func EnsureHash(h *hash.Hash, v Value) hash.Hash
- func EscapeStructField(input string) string
- func HeightOrder(a, b Ref) bool
- func IsPrimitiveKind(k NomsKind) bool
- func IsSubtype(requiredType, concreteType *Type) bool
- func NewStreamingList(vrw ValueReadWriter, values <-chan Value) <-chan List
- func NewStreamingMap(vrw ValueReadWriter, kvs <-chan Value) <-chan Map
- func NewStreamingSet(vrw ValueReadWriter, vals <-chan Value) <-chan Set
- func WriteEncodedValue(w io.Writer, v Value) error
- func WriteEncodedValueWithTags(w io.Writer, v Value) error
- type BatchStore
- type BatchStoreAdaptor
- func (bsa *BatchStoreAdaptor) AddHints(hints Hints)
- func (bsa *BatchStoreAdaptor) Close() error
- func (bsa *BatchStoreAdaptor) Flush()
- func (bsa *BatchStoreAdaptor) Get(h hash.Hash) chunks.Chunk
- func (bsa *BatchStoreAdaptor) IsValidating() bool
- func (bsa *BatchStoreAdaptor) Root() hash.Hash
- func (bsa *BatchStoreAdaptor) SchedulePut(c chunks.Chunk, refHeight uint64, hints Hints)
- func (bsa *BatchStoreAdaptor) UpdateRoot(current, last hash.Hash) bool
- type Blob
- func (b Blob) ChildValues() []Value
- func (b Blob) Chunks() []Ref
- func (b Blob) Empty() bool
- func (b Blob) Equals(other Value) bool
- func (b Blob) Hash() hash.Hash
- func (b Blob) Len() uint64
- func (b Blob) Less(other Value) bool
- func (b Blob) Reader() io.ReadSeeker
- func (b Blob) Splice(idx uint64, deleteCount uint64, data []byte) Blob
- func (b Blob) Type() *Type
- type BlobReader
- type Bool
- type Collection
- type CompoundDesc
- type CycleDesc
- type DiffChangeType
- type EditDistanceEqualsFn
- type FieldPath
- type HashIndexPath
- type Hints
- type IndexPath
- type List
- func (l List) Append(vs ...Value) List
- func (l List) ChildValues() (values []Value)
- func (l List) Chunks() []Ref
- func (l List) Diff(last List, changes chan<- Splice, closeChan <-chan struct{})
- func (l List) DiffWithLimit(last List, changes chan<- Splice, closeChan <-chan struct{}, ...)
- func (l List) Empty() bool
- func (l List) Equals(other Value) bool
- func (l List) Get(idx uint64) Value
- func (l List) Hash() hash.Hash
- func (l List) Insert(idx uint64, vs ...Value) List
- func (l List) Iter(f listIterFunc)
- func (l List) IterAll(f listIterAllFunc)
- func (l List) Len() uint64
- func (l List) Less(other Value) bool
- func (l List) Map(mf MapFunc) []interface{}
- func (l List) Remove(start uint64, end uint64) List
- func (l List) RemoveAt(idx uint64) List
- func (l List) Set(idx uint64, v Value) List
- func (l List) Splice(idx uint64, deleteCount uint64, vs ...Value) List
- func (l List) Type() *Type
- type Map
- func (m Map) ChildValues() (values []Value)
- func (m Map) Chunks() []Ref
- func (m Map) Diff(last Map, changes chan<- ValueChanged, closeChan <-chan struct{})
- func (m Map) DiffLeftRight(last Map, changes chan<- ValueChanged, closeChan <-chan struct{})
- func (m Map) Empty() bool
- func (m Map) Equals(other Value) bool
- func (m Map) First() (Value, Value)
- func (m Map) Get(key Value) Value
- func (m Map) Has(key Value) bool
- func (m Map) Hash() hash.Hash
- func (m Map) Iter(cb mapIterCallback)
- func (m Map) IterAll(cb mapIterAllCallback)
- func (m Map) IterFrom(start Value, cb mapIterCallback)
- func (m Map) Len() uint64
- func (m Map) Less(other Value) bool
- func (m Map) MaybeGet(key Value) (v Value, ok bool)
- func (m Map) Remove(k Value) Map
- func (m Map) Set(key Value, val Value) Map
- func (m Map) SetM(kv ...Value) Map
- func (m Map) Type() *Type
- type MapFunc
- type NomsKind
- type Number
- type Path
- type PathPart
- type PrimitiveDesc
- type Ref
- func (r Ref) ChildValues() []Value
- func (r Ref) Chunks() (chunks []Ref)
- func (r Ref) Equals(other Value) bool
- func (r Ref) Hash() hash.Hash
- func (r Ref) Height() uint64
- func (r Ref) Less(other Value) bool
- func (r Ref) TargetHash() hash.Hash
- func (r Ref) TargetValue(vr ValueReader) Value
- func (r Ref) Type() *Type
- type RefByHeight
- func (h *RefByHeight) DropIndices(indices []int)
- func (h RefByHeight) Empty() bool
- func (h RefByHeight) Len() int
- func (h RefByHeight) Less(i, j int) bool
- func (h RefByHeight) PeekAt(idx int) (peek Ref)
- func (h RefByHeight) PeekEnd() (head Ref)
- func (h *RefByHeight) PopBack() Ref
- func (h *RefByHeight) PushBack(r Ref)
- func (h RefByHeight) Swap(i, j int)
- func (h *RefByHeight) Unique()
- type RefSlice
- type Set
- func (s Set) ChildValues() (values []Value)
- func (s Set) Chunks() []Ref
- func (s Set) Diff(last Set, changes chan<- ValueChanged, closeChan <-chan struct{})
- func (s Set) DiffLeftRight(last Set, changes chan<- ValueChanged, closeChan <-chan struct{})
- func (s Set) Empty() bool
- func (s Set) Equals(other Value) bool
- func (s Set) First() Value
- func (s Set) Has(v Value) bool
- func (s Set) Hash() hash.Hash
- func (s Set) Insert(values ...Value) Set
- func (s Set) Iter(cb setIterCallback)
- func (s Set) IterAll(cb setIterAllCallback)
- func (s Set) Len() uint64
- func (s Set) Less(other Value) bool
- func (s Set) Remove(values ...Value) Set
- func (s Set) Type() *Type
- type Splice
- type String
- type Struct
- func (s Struct) ChildValues() []Value
- func (s Struct) Chunks() (chunks []Ref)
- func (s1 Struct) Diff(s2 Struct, changes chan<- ValueChanged, closeChan <-chan struct{})
- func (s Struct) Equals(other Value) bool
- func (s Struct) Get(n string) Value
- func (s Struct) Hash() hash.Hash
- func (s Struct) Less(other Value) bool
- func (s Struct) MaybeGet(n string) (Value, bool)
- func (s Struct) Set(n string, v Value) Struct
- func (s Struct) Type() *Type
- type StructData
- type StructDesc
- type Type
- func MakeCycleType(level uint32) *Type
- func MakeListType(elemType *Type) *Type
- func MakeMapType(keyType, valType *Type) *Type
- func MakePrimitiveType(k NomsKind) *Type
- func MakePrimitiveTypeByString(p string) *Type
- func MakeRefType(elemType *Type) *Type
- func MakeSetType(elemType *Type) *Type
- func MakeStructType(name string, fieldNames []string, fieldTypes []*Type) *Type
- func MakeUnionType(elemTypes ...*Type) *Type
- func (t *Type) ChildValues() (res []Value)
- func (t *Type) Chunks() (chunks []Ref)
- func (t *Type) Describe() (out string)
- func (t *Type) Equals(other Value) (res bool)
- func (t *Type) HasUnresolvedCycle() bool
- func (t *Type) Hash() hash.Hash
- func (t *Type) Kind() NomsKind
- func (t *Type) Less(other Value) (res bool)
- func (t *Type) Type() *Type
- type TypeCache
- type TypeDesc
- type TypeMap
- type ValidatingBatchingSink
- type Value
- type ValueChanged
- type ValueReadWriter
- type ValueReader
- type ValueSlice
- type ValueStore
- type ValueWriter
Constants ¶
const ( DEFAULT_MAX_SPLICE_MATRIX_SIZE = 2e7 SPLICE_UNASSIGNED = math.MaxUint64 UNCHANGED = 0 UPDATED = 1 INSERTED = 2 REMOVED = 3 )
Variables ¶
var BlobType = makePrimitiveType(BlobKind)
var BoolType = makePrimitiveType(BoolKind)
var EmptyStruct = Struct{ValueSlice{}, EmptyStructType, &hash.Hash{}}
var EmptyStructType = MakeStructType("", []string{}, []*Type{})
var KindToString = map[NomsKind]string{
BlobKind: "Blob",
BoolKind: "Bool",
CycleKind: "Cycle",
ListKind: "List",
MapKind: "Map",
NumberKind: "Number",
RefKind: "Ref",
SetKind: "Set",
StructKind: "Struct",
StringKind: "String",
TypeKind: "Type",
UnionKind: "Union",
ValueKind: "Value",
}
var NumberType = makePrimitiveType(NumberKind)
var StringType = makePrimitiveType(StringKind)
var TypeType = makePrimitiveType(TypeKind)
var ValueType = makePrimitiveType(ValueKind)
Functions ¶
func EncodeValue ¶
func EncodeValue(v Value, vw ValueWriter) chunks.Chunk
func EncodedIndexValue ¶
func EncodedValue ¶
func EncodedValueWithTags ¶
func EscapeStructField ¶
Escapes names for use as noms structs. Disallowed characters are encoded as 'Q<hex-encoded-utf8-bytes>'. Note that Q itself is also escaped since it is the escape character.
func HeightOrder ¶
HeightOrder returns true if a is 'higher than' b, generally if its ref-height is greater. If the two are of the same height, fall back to sorting by TargetHash.
func IsPrimitiveKind ¶
IsPrimitiveKind returns true if k represents a Noms primitive type, which excludes collections (List, Map, Set), Refs, Structs, Symbolic and Unresolved types.
func IsSubtype ¶
IsSubtype determines whether concreteType is a subtype is requiredType. For example, `Number` is a subtype of `Number | String`.
func NewStreamingList ¶
func NewStreamingList(vrw ValueReadWriter, values <-chan Value) <-chan List
NewStreamingList creates a new List with type t, populated with values, chunking if and when needed. As chunks are created, they're written to vrw -- including the root chunk of the list. Once the caller has closed values, she can read the completed List from the returned channel.
func NewStreamingMap ¶
func NewStreamingMap(vrw ValueReadWriter, kvs <-chan Value) <-chan Map
func NewStreamingSet ¶
func NewStreamingSet(vrw ValueReadWriter, vals <-chan Value) <-chan Set
func WriteEncodedValue ¶
WriteEncodedValue writes the serialization of a value
Types ¶
type BatchStore ¶
type BatchStore interface { // IsValidating indicates whether this implementation can internally enforce chunk validity & completeness. If a BatchStore supports this, it must also support "staging" of writes -- that is, allowing chunks to be written which reference chunks which have yet to be written. IsValidating() bool // Get returns from the store the Value Chunk by h. If h is absent from the store, chunks.EmptyChunk is returned. Get(h hash.Hash) chunks.Chunk // SchedulePut enqueues a write for the Chunk c with the given refHeight. Typically, the Value which was encoded to provide c can also be queried for its refHeight. The call may or may not block until c is persisted. The provided hints are used to assist in validation. Validation requires checking that all refs embedded in c are themselves valid, which could naively be done by resolving each one. Instead, hints provides a (smaller) set of refs that point to Chunks that themselves contain many of c's refs. Thus, by checking only the hinted Chunks, c can be validated with fewer read operations. // c may or may not be persisted when Put() returns, but is guaranteed to be persistent after a call to Flush() or Close(). SchedulePut(c chunks.Chunk, refHeight uint64, hints Hints) // AddHints allows additional hints, as used by SchedulePut, to be added for use in the current batch. AddHints(hints Hints) // Flush causes enqueued Puts to be persisted. Flush() chunks.RootTracker io.Closer }
BatchStore provides an interface similar to chunks.ChunkStore, but batch-oriented. Instead of Put(), it provides SchedulePut(), which enqueues a Chunk to be sent at a possibly later time.
func NewBatchStoreAdaptor ¶
func NewBatchStoreAdaptor(cs chunks.ChunkStore) BatchStore
NewBatchStoreAdaptor returns a BatchStore instance backed by a ChunkStore. Takes ownership of cs and manages its lifetime; calling Close on the returned BatchStore will Close cs.
type BatchStoreAdaptor ¶
type BatchStoreAdaptor struct {
// contains filtered or unexported fields
}
BatchStoreAdaptor provides a naive implementation of BatchStore should only be used with ChunkStores that can Put relatively quickly. It provides no actual batching or validation. Its intended use is for adapting a ChunkStore for use in something that requires a BatchStore.
func (*BatchStoreAdaptor) AddHints ¶
func (bsa *BatchStoreAdaptor) AddHints(hints Hints)
AddHints is a noop.
func (*BatchStoreAdaptor) Close ¶
func (bsa *BatchStoreAdaptor) Close() error
Close closes the underlying ChunkStore
func (*BatchStoreAdaptor) Get ¶
func (bsa *BatchStoreAdaptor) Get(h hash.Hash) chunks.Chunk
Get simply proxies to the backing ChunkStore
func (*BatchStoreAdaptor) IsValidating ¶
func (bsa *BatchStoreAdaptor) IsValidating() bool
func (*BatchStoreAdaptor) Root ¶
func (bsa *BatchStoreAdaptor) Root() hash.Hash
func (*BatchStoreAdaptor) SchedulePut ¶
func (bsa *BatchStoreAdaptor) SchedulePut(c chunks.Chunk, refHeight uint64, hints Hints)
SchedulePut simply calls Put on the underlying ChunkStore, and ignores hints.
func (*BatchStoreAdaptor) UpdateRoot ¶
func (bsa *BatchStoreAdaptor) UpdateRoot(current, last hash.Hash) bool
type Blob ¶
type Blob struct {
// contains filtered or unexported fields
}
Blob represents a list of Blobs.
func NewEmptyBlob ¶
func NewEmptyBlob() Blob
func NewStreamingBlob ¶
func NewStreamingBlob(r io.Reader, vrw ValueReadWriter) Blob
func (Blob) ChildValues ¶
func (Blob) Reader ¶
func (b Blob) Reader() io.ReadSeeker
BUG 155 - Should provide Write... Maybe even have Blob implement ReadWriteSeeker
type BlobReader ¶
type BlobReader struct {
// contains filtered or unexported fields
}
type Collection ¶
type CompoundDesc ¶
type CompoundDesc struct { ElemTypes typeSlice // contains filtered or unexported fields }
CompoundDesc describes a List, Map, Set, Ref, or Union type. ElemTypes indicates what type or types are in the container indicated by kind, e.g. Map key and value or Set element.
func (CompoundDesc) HasUnresolvedCycle ¶
func (c CompoundDesc) HasUnresolvedCycle(visited []*Type) bool
func (CompoundDesc) Kind ¶
func (c CompoundDesc) Kind() NomsKind
type DiffChangeType ¶
type DiffChangeType uint8
const ( DiffChangeAdded DiffChangeType = iota DiffChangeRemoved DiffChangeModified )
type EditDistanceEqualsFn ¶
type FieldPath ¶
type FieldPath struct { // The name of the field, e.g. `.Name`. Name string }
Gets Struct field values by name.
func NewFieldPath ¶
type HashIndexPath ¶
type HashIndexPath struct { // The hash of the key or value to search for. Maps and Set are ordered, so this in O(log(size)). Hash hash.Hash // Whether this index should resolve to the key of a map, given by a `@key` annotation. // Typically IntoKey is false, and indices would resolve to the values. E.g. given `{a: 42}` and if the hash of `"a"` is `#abcd`, then `[#abcd]` resolves to `42`. // If IntoKey is true, then it resolves to `"a"`. This is useful for when Map keys aren't primitive values, e.g. a struct, since struct literals can't be spelled using a Path. IntoKey bool }
Indexes into Maps by the hash of a key, or a Set by the hash of a value.
func NewHashIndexIntoKeyPath ¶
func NewHashIndexIntoKeyPath(h hash.Hash) HashIndexPath
func NewHashIndexPath ¶
func NewHashIndexPath(h hash.Hash) HashIndexPath
func (HashIndexPath) Resolve ¶
func (hip HashIndexPath) Resolve(v Value) (res Value)
func (HashIndexPath) String ¶
func (hip HashIndexPath) String() string
type Hints ¶
Hints are a set of hashes that should be used to speed up the validation of one or more Chunks.
type IndexPath ¶
type IndexPath struct { // The value of the index, e.g. `[42]` or `["value"]`. Index Value // Whether this index should resolve to the key of a map, given by a `@key` annotation. // Typically IntoKey is false, and indices would resolve to the values. E.g. given `{a: 42}` then `["a"]` resolves to `42`. // If IntoKey is true, then it resolves to `"a"`. For IndexPath this isn't particularly useful - it's mostly provided for consistency with HashIndexPath - but note that given `{a: 42}` then `["b"]` resolves to nil, not `"b"`. IntoKey bool }
Indexes into Maps and Lists by key or index.
func NewIndexIntoKeyPath ¶
func NewIndexPath ¶
type List ¶
type List struct {
// contains filtered or unexported fields
}
func NewList ¶
NewList creates a new List where the type is computed from the elements in the list, populated with values, chunking if and when needed.
func (List) ChildValues ¶
func (List) DiffWithLimit ¶
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
func (Map) ChildValues ¶
func (Map) Diff ¶
func (m Map) Diff(last Map, changes chan<- ValueChanged, closeChan <-chan struct{})
Computes the diff from |last| to |m| using "best" algorithm, which balances returning results early vs completing quickly.
func (Map) DiffLeftRight ¶
func (m Map) DiffLeftRight(last Map, changes chan<- ValueChanged, closeChan <-chan struct{})
Like Diff() but uses a left-to-right streaming approach, optimised for returning results early, but not completing quickly.
type NomsKind ¶
type NomsKind uint8
NomsKind allows a TypeDesc to indicate what kind of type is described.
const ( BoolKind NomsKind = iota NumberKind StringKind BlobKind ValueKind ListKind MapKind RefKind SetKind StructKind TypeKind CycleKind // Only used in encoding/decoding. UnionKind )
All supported kinds of Noms types are enumerated here. The ordering of these (especially Bool, Number and String) is important for ordering of values.
type Path ¶
type Path []PathPart
A Path is an address to a Noms value - and unlike hashes (i.e. #abcd...) they can address inlined values. See https://github.com/attic-labs/noms/blob/master/doc/spelling.md.
type PrimitiveDesc ¶
type PrimitiveDesc NomsKind
PrimitiveDesc implements TypeDesc for all primitive Noms types: Blob Bool Number Package String Type Value
func (PrimitiveDesc) HasUnresolvedCycle ¶
func (p PrimitiveDesc) HasUnresolvedCycle(visited []*Type) bool
func (PrimitiveDesc) Kind ¶
func (p PrimitiveDesc) Kind() NomsKind
type Ref ¶
type Ref struct {
// contains filtered or unexported fields
}
func (Ref) ChildValues ¶
func (Ref) TargetHash ¶
func (Ref) TargetValue ¶
func (r Ref) TargetValue(vr ValueReader) Value
type RefByHeight ¶
type RefByHeight []Ref
RefByHeight implements sort.Interface to order by increasing HeightOrder(). It uses increasing order because this causes repeated pushes and pops of the 'tallest' Refs to re-use memory, avoiding reallocations. We might consider making this a firmer abstraction boundary as a part of BUG 2182
func (*RefByHeight) DropIndices ¶
func (h *RefByHeight) DropIndices(indices []int)
DropIndices takes a slice of integer indices into h and splices out the Refs at those indices.
func (RefByHeight) Empty ¶
func (h RefByHeight) Empty() bool
func (RefByHeight) Len ¶
func (h RefByHeight) Len() int
func (RefByHeight) Less ¶
func (h RefByHeight) Less(i, j int) bool
func (RefByHeight) PeekAt ¶
func (h RefByHeight) PeekAt(idx int) (peek Ref)
PeekAt returns, but does not remove, the Ref at h[idx]. If the index is out of range, returns the empty Ref.
func (RefByHeight) PeekEnd ¶
func (h RefByHeight) PeekEnd() (head Ref)
PeekEnd returns, but does not Pop the tallest Ref in h.
func (*RefByHeight) PopBack ¶
func (h *RefByHeight) PopBack() Ref
func (*RefByHeight) PushBack ¶
func (h *RefByHeight) PushBack(r Ref)
func (RefByHeight) Swap ¶
func (h RefByHeight) Swap(i, j int)
func (*RefByHeight) Unique ¶
func (h *RefByHeight) Unique()
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
func (Set) ChildValues ¶
func (Set) Diff ¶
func (s Set) Diff(last Set, changes chan<- ValueChanged, closeChan <-chan struct{})
Computes the diff from |last| to |s| using "best" algorithm, which balances returning results early vs completing quickly.
func (Set) DiffLeftRight ¶
func (s Set) DiffLeftRight(last Set, changes chan<- ValueChanged, closeChan <-chan struct{})
Like Diff() but uses a left-to-right streaming approach, optimised for returning results early, but not completing quickly.
type Splice ¶
Read a Splice as "at SpAt (in the previous state), SpRemoved elements were removed and SpAdded elements were inserted, which can be found starting at SpFrom in the current state"
type Struct ¶
type Struct struct {
// contains filtered or unexported fields
}
func NewStruct ¶
func NewStruct(name string, data StructData) Struct
func NewStructWithType ¶
func NewStructWithType(t *Type, data ValueSlice) Struct
func (Struct) ChildValues ¶
func (Struct) Diff ¶
func (s1 Struct) Diff(s2 Struct, changes chan<- ValueChanged, closeChan <-chan struct{})
type StructData ¶
type StructDesc ¶
type StructDesc struct { Name string // contains filtered or unexported fields }
StructDesc describes a custom Noms Struct.
func (StructDesc) Field ¶
func (s StructDesc) Field(name string) *Type
func (StructDesc) HasUnresolvedCycle ¶
func (s StructDesc) HasUnresolvedCycle(visited []*Type) bool
func (StructDesc) IterFields ¶
func (s StructDesc) IterFields(cb func(name string, t *Type))
func (StructDesc) Kind ¶
func (s StructDesc) Kind() NomsKind
func (StructDesc) Len ¶
func (s StructDesc) Len() int
Len returns the number of fields in the struct
type Type ¶
type Type struct { Desc TypeDesc // contains filtered or unexported fields }
func MakeCycleType ¶
func MakeListType ¶
func MakeMapType ¶
func MakePrimitiveType ¶
func MakeRefType ¶
func MakeSetType ¶
func MakeStructType ¶
func MakeUnionType ¶
func (*Type) ChildValues ¶
func (*Type) HasUnresolvedCycle ¶
type TypeCache ¶
type TypeCache struct {
// contains filtered or unexported fields
}
func NewTypeCache ¶
func NewTypeCache() *TypeCache
type TypeDesc ¶
TypeDesc describes a type of the kind returned by Kind(), e.g. Map, Number, or a custom type.
type ValidatingBatchingSink ¶
type ValidatingBatchingSink struct {
// contains filtered or unexported fields
}
func NewValidatingBatchingSink ¶
func NewValidatingBatchingSink(cs chunks.ChunkStore, tc *TypeCache) *ValidatingBatchingSink
func (*ValidatingBatchingSink) Enqueue ¶
func (vbs *ValidatingBatchingSink) Enqueue(c chunks.Chunk) chunks.BackpressureError
Enequeue adds a Chunk to the queue of Chunks waiting to be Put into vbs' backing ChunkStore. The instance keeps an internal buffer of Chunks, spilling to the ChunkStore when the buffer is full. If an attempt to Put Chunks fails, this method returns the BackpressureError from the underlying ChunkStore.
func (*ValidatingBatchingSink) Flush ¶
func (vbs *ValidatingBatchingSink) Flush() (err chunks.BackpressureError)
Flush Puts any Chunks buffered by Enqueue calls into the backing ChunkStore. If the attempt to Put fails, this method returns the BackpressureError returned by the underlying ChunkStore.
func (*ValidatingBatchingSink) Prepare ¶
func (vbs *ValidatingBatchingSink) Prepare(hints Hints)
Prepare primes the type info cache used to validate Enqueued Chunks by reading the Chunks referenced by the provided hints.
type Value ¶
type Value interface { Equals(other Value) bool Less(other Value) bool Hash() hash.Hash // Returns the immediate children of this value in the DAG, if any, not including Type(). ChildValues() []Value Chunks() []Ref Type() *Type }
Value is implemented by every noms value
func DecodeFromBytes ¶
func DecodeFromBytes(data []byte, vr ValueReader, tc *TypeCache) Value
func DecodeValue ¶
func DecodeValue(c chunks.Chunk, vr ValueReader) Value
DecodeValue decodes a value from a chunk source. It is an error to provide an empty chunk.
type ValueChanged ¶
type ValueChanged struct { ChangeType DiffChangeType V Value }
type ValueReadWriter ¶
type ValueReadWriter interface { ValueReader ValueWriter // contains filtered or unexported methods }
ValueReadWriter is an interface that knows how to read and write Noms Values, e.g. datas/Database. Required to avoid import cycle between this package and the package that implements Value read/writing.
type ValueReader ¶
ValueReader is an interface that knows how to read Noms Values, e.g. datas/Database. Required to avoid import cycle between this package and the package that implements Value reading.
type ValueSlice ¶
type ValueSlice []Value
func (ValueSlice) Equals ¶
func (vs ValueSlice) Equals(other ValueSlice) bool
func (ValueSlice) Len ¶
func (vs ValueSlice) Len() int
func (ValueSlice) Less ¶
func (vs ValueSlice) Less(i, j int) bool
func (ValueSlice) Swap ¶
func (vs ValueSlice) Swap(i, j int)
type ValueStore ¶
type ValueStore struct {
// contains filtered or unexported fields
}
ValueStore provides methods to read and write Noms Values to a BatchStore. It validates Values as they are written, but does not guarantee that these Values are persisted to the BatchStore until a subsequent Flush. or Close. Currently, WriteValue validates the following properties of a Value v: - v can be correctly serialized and its Ref taken - all Refs in v point to a Value that can be read from this ValueStore - all Refs in v point to a Value of the correct Type
func NewTestValueStore ¶
func NewTestValueStore() *ValueStore
NewTestValueStore creates a simple struct that satisfies ValueReadWriter and is backed by a chunks.TestStore.
func NewValueStore ¶
func NewValueStore(bs BatchStore) *ValueStore
NewValueStore returns a ValueStore instance that owns the provided BatchStore and manages its lifetime. Calling Close on the returned ValueStore will Close bs.
func NewValueStoreWithCache ¶
func NewValueStoreWithCache(bs BatchStore, cacheSize uint64) *ValueStore
func (*ValueStore) BatchStore ¶
func (lvs *ValueStore) BatchStore() BatchStore
func (*ValueStore) Close ¶
func (lvs *ValueStore) Close() error
Close closes the underlying BatchStore
func (*ValueStore) Flush ¶
func (lvs *ValueStore) Flush()
func (*ValueStore) ReadValue ¶
func (lvs *ValueStore) ReadValue(r hash.Hash) Value
ReadValue reads and decodes a value from lvs. It is not considered an error for the requested chunk to be empty; in this case, the function simply returns nil.
func (*ValueStore) WriteValue ¶
func (lvs *ValueStore) WriteValue(v Value) Ref
WriteValue takes a Value, schedules it to be written it to lvs, and returns an appropriately-typed types.Ref. v is not guaranteed to be actually written until after Flush().
type ValueWriter ¶
ValueWriter is an interface that knows how to write Noms Values, e.g. datas/Database. Required to avoid import cycle between this package and the package that implements Value writing.
Source Files ¶
- assert_type.go
- batch_store.go
- blob.go
- blob_leaf_sequence.go
- bool.go
- codec.go
- collection.go
- edit_distance.go
- encode_human_readable.go
- get_hash.go
- indexed_sequence_diff.go
- indexed_sequences.go
- less.go
- list.go
- list_leaf_sequence.go
- map.go
- mapMutator.go
- map_leaf_sequence.go
- meta_sequence.go
- noms_kind.go
- number.go
- number_util.go
- opcache.go
- opcache_compare.go
- ordered_sequences.go
- ordered_sequences_diff.go
- path.go
- ref.go
- ref_heap.go
- rolling_value_hasher.go
- rungen.go
- sequence.go
- sequence_chunker.go
- sequence_cursor.go
- set.go
- setMutator.go
- set_leaf_sequence.go
- string.go
- struct.go
- type.go
- type_cache.go
- type_desc.go
- validating_batching_sink.go
- value.go
- value_decoder.go
- value_encoder.go
- value_store.go