Documentation
¶
Overview ¶
Package referenceindex derives and reconciles current relationship and upload references from canonical store values. It is shared by official stores so the strict test adapter and PostgreSQL cannot silently diverge.
Index ¶
- func FindReferenceField(collection schema.Collection, fieldID schema.StableID) (reference schema.Field, root schema.Field, found bool)
- func NullifyField(field schema.Field, value store.Value, target store.DocumentReference, ...) (store.Value, bool, error)
- func NullifyTarget(collection schema.Collection, values store.Values, ...) (store.Values, bool, error)
- func ReferenceFieldIDs(root schema.Field) []schema.StableID
- func RemoveResourceTargets(collection schema.Collection, values store.Values, resources []schema.StableID) (store.Values, bool, error)
- func TargetsAnyResource(collection schema.Collection, resourceIDs []schema.StableID) bool
- type Entry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindReferenceField ¶
func FindReferenceField(collection schema.Collection, fieldID schema.StableID) (reference schema.Field, root schema.Field, found bool)
FindReferenceField locates a relationship/upload field and its stored root field by stable ID.
func NullifyField ¶
func NullifyTarget ¶
func NullifyTarget(collection schema.Collection, values store.Values, target store.DocumentReference) (store.Values, bool, error)
func ReferenceFieldIDs ¶
ReferenceFieldIDs returns every relationship/upload field ID beneath one stored root field.
func RemoveResourceTargets ¶
func TargetsAnyResource ¶
func TargetsAnyResource(collection schema.Collection, resourceIDs []schema.StableID) bool
TargetsAnyResource reports whether the collection's current reference or upload topology can address one of the supplied resource IDs. Migration rollback uses this to purge version snapshots that could otherwise restore an identity after its resource is reintroduced.
Types ¶
type Entry ¶
type Entry struct {
Owner store.DocumentReference
FieldID schema.StableID
Target store.DocumentReference
Locale schema.LocaleCode
Occurrence int
}
Entry is one current reference occurrence owned by a document. Occurrence is deterministic within the owner/field/target/locale tuple and permits duplicate list members without collapsing the derived index.
func Collect ¶
Collect validates the complete declared envelope before deriving any index entries. A malformed or over-budget tree must never yield a partial index.
func CollectField ¶
func CollectField(owner store.DocumentReference, field schema.Field, value store.Value, locale schema.LocaleCode) ([]Entry, error)