Documentation ¶
Overview ¶
Package models implements storage and retrieval of topic maps in a local key-value store using package kv.
Index ¶
- Constants
- type IIs
- type Name
- type Occurrence
- type SIs
- type SLs
- type TopicMapInfo
- type TopicNames
- type TopicOccurrences
- type Txn
- func (s Txn) AllIIsEntities(start *kv.Entity, n int) (es []kv.Entity, err error)
- func (s Txn) AllNameEntities(start *kv.Entity, n int) (es []kv.Entity, err error)
- func (s Txn) AllOccurrenceEntities(start *kv.Entity, n int) (es []kv.Entity, err error)
- func (s Txn) AllSIsEntities(start *kv.Entity, n int) (es []kv.Entity, err error)
- func (s Txn) AllSLsEntities(start *kv.Entity, n int) (es []kv.Entity, err error)
- func (s Txn) AllTopicMapInfoEntities(start *kv.Entity, n int) (es []kv.Entity, err error)
- func (s Txn) AllTopicNamesEntities(start *kv.Entity, n int) (es []kv.Entity, err error)
- func (s Txn) AllTopicOccurrencesEntities(start *kv.Entity, n int) (es []kv.Entity, err error)
- func (s Txn) DeleteIIs(e kv.Entity) error
- func (s Txn) DeleteName(e kv.Entity) error
- func (s Txn) DeleteOccurrence(e kv.Entity) error
- func (s Txn) DeleteSIs(e kv.Entity) error
- func (s Txn) DeleteSLs(e kv.Entity) error
- func (s Txn) DeleteTopicMapInfo(e kv.Entity) error
- func (s Txn) DeleteTopicNames(e kv.Entity) error
- func (s Txn) DeleteTopicOccurrences(e kv.Entity) error
- func (s Txn) EntitiesByIIsLiteral(cursor *kv.IndexCursor, n int) (es []kv.Entity, err error)
- func (s Txn) EntitiesByNameValue(cursor *kv.IndexCursor, n int) (es []kv.Entity, err error)
- func (s Txn) EntitiesByOccurrenceValue(cursor *kv.IndexCursor, n int) (es []kv.Entity, err error)
- func (s Txn) EntitiesBySIsLiteral(cursor *kv.IndexCursor, n int) (es []kv.Entity, err error)
- func (s Txn) EntitiesBySLsLiteral(cursor *kv.IndexCursor, n int) (es []kv.Entity, err error)
- func (s Txn) EntitiesMatchingIIsLiteral(v kv.String) (kv.EntitySlice, error)
- func (s Txn) EntitiesMatchingNameValue(v kv.String) (kv.EntitySlice, error)
- func (s Txn) EntitiesMatchingOccurrenceValue(v kv.String) (kv.EntitySlice, error)
- func (s Txn) EntitiesMatchingSIsLiteral(v kv.String) (kv.EntitySlice, error)
- func (s Txn) EntitiesMatchingSLsLiteral(v kv.String) (kv.EntitySlice, error)
- func (s Txn) GetIIs(e kv.Entity) (IIs, error)
- func (s Txn) GetIIsSlice(es []kv.Entity) ([]IIs, error)
- func (s Txn) GetName(e kv.Entity) (Name, error)
- func (s Txn) GetNameSlice(es []kv.Entity) ([]Name, error)
- func (s Txn) GetOccurrence(e kv.Entity) (Occurrence, error)
- func (s Txn) GetOccurrenceSlice(es []kv.Entity) ([]Occurrence, error)
- func (s Txn) GetSIs(e kv.Entity) (SIs, error)
- func (s Txn) GetSIsSlice(es []kv.Entity) ([]SIs, error)
- func (s Txn) GetSLs(e kv.Entity) (SLs, error)
- func (s Txn) GetSLsSlice(es []kv.Entity) ([]SLs, error)
- func (s Txn) GetTopicMapInfo(e kv.Entity) (TopicMapInfo, error)
- func (s Txn) GetTopicMapInfoSlice(es []kv.Entity) ([]TopicMapInfo, error)
- func (s Txn) GetTopicNames(e kv.Entity) (TopicNames, error)
- func (s Txn) GetTopicNamesSlice(es []kv.Entity) ([]TopicNames, error)
- func (s Txn) GetTopicOccurrences(e kv.Entity) (TopicOccurrences, error)
- func (s Txn) GetTopicOccurrencesSlice(es []kv.Entity) ([]TopicOccurrences, error)
- func (s Txn) SetIIs(e kv.Entity, v IIs) error
- func (s Txn) SetName(e kv.Entity, v *Name) error
- func (s Txn) SetOccurrence(e kv.Entity, v *Occurrence) error
- func (s Txn) SetSIs(e kv.Entity, v SIs) error
- func (s Txn) SetSLs(e kv.Entity, v SLs) error
- func (s Txn) SetTopicMapInfo(e kv.Entity, v *TopicMapInfo) error
- func (s Txn) SetTopicNames(e kv.Entity, v TopicNames) error
- func (s Txn) SetTopicOccurrences(e kv.Entity, v TopicOccurrences) error
- type UnsupportedFormatError
Constants ¶
const ( TopicMapInfoPrefix kv.Component = 0x0001 LiteralPrefix kv.Component = 0x0002 IIsPrefix kv.Component = 0x0003 SIsPrefix kv.Component = 0x0004 SLsPrefix kv.Component = 0x0005 TopicNamesPrefix kv.Component = 0x0006 TopicOccurrencesPrefix kv.Component = 0x0007 NamePrefix kv.Component = 0x0008 OccurrencePrefix kv.Component = 0x0009 ValuePrefix kv.Component = 0x000A )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Name ¶
Name wraps pb.Name to implement kv.Encoder and kv.Decoder interfaces.
func (*Name) IndexValue ¶
type Occurrence ¶
type Occurrence struct{ pb.Occurrence }
Occurrence wraps pb.Names to implement kv.Encoder and kv.Decoder interfaces.
func (*Occurrence) Decode ¶
func (o *Occurrence) Decode(src []byte) error
func (*Occurrence) Encode ¶
func (o *Occurrence) Encode() []byte
func (*Occurrence) IndexValue ¶
func (o *Occurrence) IndexValue() []kv.String
type TopicMapInfo ¶
type TopicMapInfo struct{ pb.TopicMapInfo }
TopicMapInfo wraps pb.TopicMapInfo to implement kv.Encoder and kv.Decoder interfaces.
func (*TopicMapInfo) Decode ¶
func (tmi *TopicMapInfo) Decode(src []byte) error
func (*TopicMapInfo) Encode ¶
func (tmi *TopicMapInfo) Encode() []byte
type TopicNames ¶
type TopicNames kv.EntitySlice
TopicNames holds a slice of all of a topic's names.
TopicNames is not sorted: names are ordered according to user preferences, and this is how that ordering is represented in kvmodels.
func (*TopicNames) Decode ¶
func (tns *TopicNames) Decode(bs []byte) error
func (TopicNames) Encode ¶
func (tns TopicNames) Encode() []byte
type TopicOccurrences ¶
type TopicOccurrences kv.EntitySlice
TopicOccurrences holds a slice of all of a topic's occurrences.
TopicOccurrences is not sorted: occurrences are ordered according to user preferences, and this is how that ordering is represented in kvmodels.
func (*TopicOccurrences) Decode ¶
func (tos *TopicOccurrences) Decode(bs []byte) error
func (TopicOccurrences) Encode ¶
func (tos TopicOccurrences) Encode() []byte
type Txn ¶
type Txn struct{ kv.Partitioned }
Txn provides entities, components, and indexes backed by a key-value store.
func (Txn) AllIIsEntities ¶
AllIIsEntities returns the first n entities that have a IIs, beginning with the first entity greater than or equal to *start.
A nil start value will be interpreted as a pointer to zero.
A value of n less than or equal to zero will be interpretted as the largest possible value.
func (Txn) AllNameEntities ¶
AllNameEntities returns the first n entities that have a Name, beginning with the first entity greater than or equal to *start.
A nil start value will be interpreted as a pointer to zero.
A value of n less than or equal to zero will be interpretted as the largest possible value.
func (Txn) AllOccurrenceEntities ¶
AllOccurrenceEntities returns the first n entities that have a Occurrence, beginning with the first entity greater than or equal to *start.
A nil start value will be interpreted as a pointer to zero.
A value of n less than or equal to zero will be interpretted as the largest possible value.
func (Txn) AllSIsEntities ¶
AllSIsEntities returns the first n entities that have a SIs, beginning with the first entity greater than or equal to *start.
A nil start value will be interpreted as a pointer to zero.
A value of n less than or equal to zero will be interpretted as the largest possible value.
func (Txn) AllSLsEntities ¶
AllSLsEntities returns the first n entities that have a SLs, beginning with the first entity greater than or equal to *start.
A nil start value will be interpreted as a pointer to zero.
A value of n less than or equal to zero will be interpretted as the largest possible value.
func (Txn) AllTopicMapInfoEntities ¶
AllTopicMapInfoEntities returns the first n entities that have a TopicMapInfo, beginning with the first entity greater than or equal to *start.
A nil start value will be interpreted as a pointer to zero.
A value of n less than or equal to zero will be interpretted as the largest possible value.
func (Txn) AllTopicNamesEntities ¶
AllTopicNamesEntities returns the first n entities that have a TopicNames, beginning with the first entity greater than or equal to *start.
A nil start value will be interpreted as a pointer to zero.
A value of n less than or equal to zero will be interpretted as the largest possible value.
func (Txn) AllTopicOccurrencesEntities ¶
AllTopicOccurrencesEntities returns the first n entities that have a TopicOccurrences, beginning with the first entity greater than or equal to *start.
A nil start value will be interpreted as a pointer to zero.
A value of n less than or equal to zero will be interpretted as the largest possible value.
func (Txn) DeleteIIs ¶
DeleteIIs deletes the IIs associated with e.
Corresponding indexes are updated.
func (Txn) DeleteName ¶
DeleteName deletes the Name associated with e.
Corresponding indexes are updated.
func (Txn) DeleteOccurrence ¶
DeleteOccurrence deletes the Occurrence associated with e.
Corresponding indexes are updated.
func (Txn) DeleteSIs ¶
DeleteSIs deletes the SIs associated with e.
Corresponding indexes are updated.
func (Txn) DeleteSLs ¶
DeleteSLs deletes the SLs associated with e.
Corresponding indexes are updated.
func (Txn) DeleteTopicMapInfo ¶
DeleteTopicMapInfo deletes the TopicMapInfo associated with e.
Corresponding indexes are updated.
func (Txn) DeleteTopicNames ¶
DeleteTopicNames deletes the TopicNames associated with e.
Corresponding indexes are updated.
func (Txn) DeleteTopicOccurrences ¶
DeleteTopicOccurrences deletes the TopicOccurrences associated with e.
Corresponding indexes are updated.
func (Txn) EntitiesByIIsLiteral ¶
EntitiesByIIsLiteral returns entities with IIs values ordered by the kv.String values from their IndexLiteral method.
Reading begins at cursor, and ends when the length of the returned Entity slice is less than n. When reading is not complete, cursor is updated such that using it in a subequent call to ByLiteral would return next n entities.
func (Txn) EntitiesByNameValue ¶
EntitiesByNameValue returns entities with Name values ordered by the kv.String values from their IndexValue method.
Reading begins at cursor, and ends when the length of the returned Entity slice is less than n. When reading is not complete, cursor is updated such that using it in a subequent call to ByValue would return next n entities.
func (Txn) EntitiesByOccurrenceValue ¶
EntitiesByOccurrenceValue returns entities with Occurrence values ordered by the kv.String values from their IndexValue method.
Reading begins at cursor, and ends when the length of the returned Entity slice is less than n. When reading is not complete, cursor is updated such that using it in a subequent call to ByValue would return next n entities.
func (Txn) EntitiesBySIsLiteral ¶
EntitiesBySIsLiteral returns entities with SIs values ordered by the kv.String values from their IndexLiteral method.
Reading begins at cursor, and ends when the length of the returned Entity slice is less than n. When reading is not complete, cursor is updated such that using it in a subequent call to ByLiteral would return next n entities.
func (Txn) EntitiesBySLsLiteral ¶
EntitiesBySLsLiteral returns entities with SLs values ordered by the kv.String values from their IndexLiteral method.
Reading begins at cursor, and ends when the length of the returned Entity slice is less than n. When reading is not complete, cursor is updated such that using it in a subequent call to ByLiteral would return next n entities.
func (Txn) EntitiesMatchingIIsLiteral ¶
EntitiesMatchingIIsLiteral returns entities with IIs values that return a matching kv.String from their IndexLiteral method.
The returned EntitySlice is already sorted.
func (Txn) EntitiesMatchingNameValue ¶
EntitiesMatchingNameValue returns entities with Name values that return a matching kv.String from their IndexValue method.
The returned EntitySlice is already sorted.
func (Txn) EntitiesMatchingOccurrenceValue ¶
EntitiesMatchingOccurrenceValue returns entities with Occurrence values that return a matching kv.String from their IndexValue method.
The returned EntitySlice is already sorted.
func (Txn) EntitiesMatchingSIsLiteral ¶
EntitiesMatchingSIsLiteral returns entities with SIs values that return a matching kv.String from their IndexLiteral method.
The returned EntitySlice is already sorted.
func (Txn) EntitiesMatchingSLsLiteral ¶
EntitiesMatchingSLsLiteral returns entities with SLs values that return a matching kv.String from their IndexLiteral method.
The returned EntitySlice is already sorted.
func (Txn) GetIIs ¶
GetIIs returns the IIs associated with e.
If no IIs has been explicitly set for e, and GetIIs will return the result of decoding a IIs from an empty slice of bytes.
func (Txn) GetIIsSlice ¶
GetIIsSlice returns a IIs for each entity in es.
If no IIs has been explicitly set for an entity, and the result will be a IIs that has been decoded from an empty slice of bytes.
func (Txn) GetName ¶
GetName returns the Name associated with e.
If no Name has been explicitly set for e, and GetName will return the result of decoding a Name from an empty slice of bytes.
func (Txn) GetNameSlice ¶
GetNameSlice returns a Name for each entity in es.
If no Name has been explicitly set for an entity, and the result will be a Name that has been decoded from an empty slice of bytes.
func (Txn) GetOccurrence ¶
func (s Txn) GetOccurrence(e kv.Entity) (Occurrence, error)
GetOccurrence returns the Occurrence associated with e.
If no Occurrence has been explicitly set for e, and GetOccurrence will return the result of decoding a Occurrence from an empty slice of bytes.
func (Txn) GetOccurrenceSlice ¶
func (s Txn) GetOccurrenceSlice(es []kv.Entity) ([]Occurrence, error)
GetOccurrenceSlice returns a Occurrence for each entity in es.
If no Occurrence has been explicitly set for an entity, and the result will be a Occurrence that has been decoded from an empty slice of bytes.
func (Txn) GetSIs ¶
GetSIs returns the SIs associated with e.
If no SIs has been explicitly set for e, and GetSIs will return the result of decoding a SIs from an empty slice of bytes.
func (Txn) GetSIsSlice ¶
GetSIsSlice returns a SIs for each entity in es.
If no SIs has been explicitly set for an entity, and the result will be a SIs that has been decoded from an empty slice of bytes.
func (Txn) GetSLs ¶
GetSLs returns the SLs associated with e.
If no SLs has been explicitly set for e, and GetSLs will return the result of decoding a SLs from an empty slice of bytes.
func (Txn) GetSLsSlice ¶
GetSLsSlice returns a SLs for each entity in es.
If no SLs has been explicitly set for an entity, and the result will be a SLs that has been decoded from an empty slice of bytes.
func (Txn) GetTopicMapInfo ¶
func (s Txn) GetTopicMapInfo(e kv.Entity) (TopicMapInfo, error)
GetTopicMapInfo returns the TopicMapInfo associated with e.
If no TopicMapInfo has been explicitly set for e, and GetTopicMapInfo will return the result of decoding a TopicMapInfo from an empty slice of bytes.
func (Txn) GetTopicMapInfoSlice ¶
func (s Txn) GetTopicMapInfoSlice(es []kv.Entity) ([]TopicMapInfo, error)
GetTopicMapInfoSlice returns a TopicMapInfo for each entity in es.
If no TopicMapInfo has been explicitly set for an entity, and the result will be a TopicMapInfo that has been decoded from an empty slice of bytes.
func (Txn) GetTopicNames ¶
func (s Txn) GetTopicNames(e kv.Entity) (TopicNames, error)
GetTopicNames returns the TopicNames associated with e.
If no TopicNames has been explicitly set for e, and GetTopicNames will return the result of decoding a TopicNames from an empty slice of bytes.
func (Txn) GetTopicNamesSlice ¶
func (s Txn) GetTopicNamesSlice(es []kv.Entity) ([]TopicNames, error)
GetTopicNamesSlice returns a TopicNames for each entity in es.
If no TopicNames has been explicitly set for an entity, and the result will be a TopicNames that has been decoded from an empty slice of bytes.
func (Txn) GetTopicOccurrences ¶
func (s Txn) GetTopicOccurrences(e kv.Entity) (TopicOccurrences, error)
GetTopicOccurrences returns the TopicOccurrences associated with e.
If no TopicOccurrences has been explicitly set for e, and GetTopicOccurrences will return the result of decoding a TopicOccurrences from an empty slice of bytes.
func (Txn) GetTopicOccurrencesSlice ¶
func (s Txn) GetTopicOccurrencesSlice(es []kv.Entity) ([]TopicOccurrences, error)
GetTopicOccurrencesSlice returns a TopicOccurrences for each entity in es.
If no TopicOccurrences has been explicitly set for an entity, and the result will be a TopicOccurrences that has been decoded from an empty slice of bytes.
func (Txn) SetName ¶
SetName sets the Name associated with e to v.
Corresponding indexes are updated.
func (Txn) SetOccurrence ¶
func (s Txn) SetOccurrence(e kv.Entity, v *Occurrence) error
SetOccurrence sets the Occurrence associated with e to v.
Corresponding indexes are updated.
func (Txn) SetTopicMapInfo ¶
func (s Txn) SetTopicMapInfo(e kv.Entity, v *TopicMapInfo) error
SetTopicMapInfo sets the TopicMapInfo associated with e to v.
Corresponding indexes are updated.
func (Txn) SetTopicNames ¶
func (s Txn) SetTopicNames(e kv.Entity, v TopicNames) error
SetTopicNames sets the TopicNames associated with e to v.
Corresponding indexes are updated.
func (Txn) SetTopicOccurrences ¶
func (s Txn) SetTopicOccurrences(e kv.Entity, v TopicOccurrences) error
SetTopicOccurrences sets the TopicOccurrences associated with e to v.
Corresponding indexes are updated.
type UnsupportedFormatError ¶
type UnsupportedFormatError byte
UnsupportedFormatError indicates that a value was found in the key-value backing store with an unsupported format code, perhaps due to data corruption.
func (UnsupportedFormatError) Error ¶
func (e UnsupportedFormatError) Error() string