Documentation ¶
Index ¶
- func NewImmutable[OuterModelType any, OuterModelPtrType PtrType[OuterModelType, InnerModelType], ...](model *InnerModelType, cacheBytes ...bool) (newInstance *OuterModelType)
- func NewMutable[OuterModelType any, OuterModelPtrType PtrType[OuterModelType, InnerModelType], ...](model *InnerModelType, cacheBytes ...bool) (newInstance *OuterModelType)
- func NewStorable[IDType, OuterModelType, InnerModelType any, ...](model *InnerModelType, cacheBytes ...bool) (newInstance *OuterModelType)
- func NewStorableReference[OuterModelType any, ...](sourceID SourceIDType, targetID TargetIDType) (newInstance *OuterModelType)
- func NewStorableReferenceWithMetadata[OuterModelType any, ...](sourceID SourceIDType, targetID TargetIDType, model *InnerModelType) (newInstance *OuterModelType)
- type Immutable
- func (i *Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) Bytes() (bytes []byte, err error)
- func (i *Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) Decode(b []byte) (int, error)
- func (i Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) Encode() ([]byte, error)
- func (i *Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) FromBytes(bytes []byte) (consumedBytes int, err error)
- func (i *Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) Init()
- func (i *Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) InnerModel() *InnerModelType
- func (i *Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) New(innerModelType *InnerModelType, cacheBytes ...bool)
- func (i *Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) String() string
- type Mutable
- func (m *Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) Bytes() (bytes []byte, err error)
- func (m *Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) Decode(b []byte) (int, error)
- func (m Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) Encode() ([]byte, error)
- func (m *Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) FromBytes(bytes []byte) (consumedBytes int, err error)
- func (m *Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) Init()
- func (m *Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) InnerModel() *InnerModelType
- func (m *Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) InvalidateBytesCache()
- func (m *Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) New(innerModelType *InnerModelType, cacheBytes ...bool)
- func (m *Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) String() string
- type PtrType
- type ReferencePtrType
- type ReferenceWithMetadataPtrType
- type Storable
- func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) Bytes() (bytes []byte, err error)
- func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) Decode(b []byte) (int, error)
- func (s Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) Encode() ([]byte, error)
- func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) FromBytes(bytes []byte) (consumedBytes int, err error)
- func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) FromObjectStorage(key, data []byte) (err error)
- func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) ID() (id IDType)
- func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) IDFromBytes(bytes []byte) (err error)
- func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) ImportStorable(other *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType])
- func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) Init()
- func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) InnerModel() *InnerModelType
- func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) InvalidateBytesCache()
- func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) New(innerModelType *InnerModelType, cacheBytes ...bool)
- func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) ObjectStorageKey() (key []byte)
- func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) ObjectStorageValue() (value []byte)
- func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) SetID(id IDType)
- func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) String() string
- type StorableReference
- func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) Bytes() (bytes []byte, err error)
- func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) Decode(b []byte) (int, error)
- func (s StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) Encode() ([]byte, error)
- func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) FromBytes(bytes []byte) (consumedBytes int, err error)
- func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) FromObjectStorage(key, _ []byte) (err error)
- func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) Init()
- func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) KeyPartitions() []int
- func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) New(sourceID SourceIDType, targetID TargetIDType)
- func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) ObjectStorageKey() (key []byte)
- func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) ObjectStorageValue() (value []byte)
- func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) SourceID() SourceIDType
- func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) String() string
- func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) TargetID() TargetIDType
- type StorableReferenceWithMetadata
- func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) Bytes() (bytes []byte, err error)
- func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) Decode(b []byte) (int, error)
- func (s StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) Encode() ([]byte, error)
- func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) FromBytes(bytes []byte) (consumedBytes int, err error)
- func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) FromObjectStorage(key, value []byte) (err error)
- func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) Init()
- func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) InnerModel() *InnerModelType
- func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) KeyPartitions() []int
- func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) New(sourceID SourceIDType, targetID TargetIDType, model *InnerModelType)
- func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) ObjectStorageKey() (key []byte)
- func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) ObjectStorageValue() (value []byte)
- func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) SourceID() SourceIDType
- func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) String() string
- func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) TargetID() TargetIDType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewImmutable ¶
func NewImmutable[OuterModelType any, OuterModelPtrType PtrType[OuterModelType, InnerModelType], InnerModelType any](model *InnerModelType, cacheBytes ...bool) (newInstance *OuterModelType)
NewImmutable creates a new immutable model instance.
func NewMutable ¶
func NewMutable[OuterModelType any, OuterModelPtrType PtrType[OuterModelType, InnerModelType], InnerModelType any](model *InnerModelType, cacheBytes ...bool) (newInstance *OuterModelType)
NewMutable creates a new mutable model instance.
func NewStorable ¶
func NewStorable[IDType, OuterModelType, InnerModelType any, OuterModelPtrType PtrType[OuterModelType, InnerModelType]](model *InnerModelType, cacheBytes ...bool) (newInstance *OuterModelType)
NewStorable creates a new storable model instance.
func NewStorableReference ¶
func NewStorableReference[OuterModelType any, OuterModelPtrType ReferencePtrType[OuterModelType, SourceIDType, TargetIDType], SourceIDType, TargetIDType any](sourceID SourceIDType, targetID TargetIDType) (newInstance *OuterModelType)
NewStorableReference creates a new storable reference model instance.
func NewStorableReferenceWithMetadata ¶
func NewStorableReferenceWithMetadata[OuterModelType any, OuterModelPtrType ReferenceWithMetadataPtrType[OuterModelType, SourceIDType, TargetIDType, InnerModelType], SourceIDType, TargetIDType, InnerModelType any](sourceID SourceIDType, targetID TargetIDType, model *InnerModelType) (newInstance *OuterModelType)
NewStorableReferenceWithMetadata creates a new storable reference model instance.
Types ¶
type Immutable ¶
type Immutable[OuterModelType any, OuterModelPtrType PtrType[OuterModelType, InnerModelType], InnerModelType any] struct { M InnerModelType // contains filtered or unexported fields }
Immutable is the base type for all immutable models. It should be embedded in a wrapper type. It provides serialization primitives.
func (*Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) Bytes ¶
func (i *Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) Bytes() (bytes []byte, err error)
Bytes serializes a model to a byte slice.
func (*Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) Decode ¶
func (i *Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) Decode(b []byte) (int, error)
Decode deserializes the model from a byte slice.
func (Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) Encode ¶
Encode serializes the "content of the model" to a byte slice.
func (*Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) FromBytes ¶
func (i *Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) FromBytes(bytes []byte) (consumedBytes int, err error)
FromBytes deserializes a model from a byte slice.
func (*Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) Init ¶
func (i *Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) Init()
Init initializes the model after it has been restored from it's serialized version.
func (*Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) InnerModel ¶
func (i *Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) InnerModel() *InnerModelType
InnerModel returns the inner Model that holds the data.
func (*Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) New ¶
func (i *Immutable[OuterModelType, OuterModelPtrType, InnerModelType]) New(innerModelType *InnerModelType, cacheBytes ...bool)
New initializes the model with the necessary values when being manually created through a constructor.
type Mutable ¶
type Mutable[OuterModelType any, OuterModelPtrType PtrType[OuterModelType, InnerModelType], InnerModelType any] struct { M InnerModelType *sync.RWMutex // contains filtered or unexported fields }
Mutable is the base type for simple mutable models. It should be embedded in a wrapper type. It provides serialization and locking primitives.
func (*Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) Bytes ¶
func (m *Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) Bytes() (bytes []byte, err error)
Bytes serializes a model to a byte slice.
func (*Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) Decode ¶
Decode deserializes the model from a byte slice.
func (Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) Encode ¶
Encode serializes the "content of the model" to a byte slice.
func (*Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) FromBytes ¶
func (m *Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) FromBytes(bytes []byte) (consumedBytes int, err error)
FromBytes deserializes a model from a byte slice.
func (*Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) Init ¶
func (m *Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) Init()
Init initializes the model after it has been restored from it's serialized version.
func (*Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) InnerModel ¶
func (m *Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) InnerModel() *InnerModelType
InnerModel returns the inner Model that holds the data.
func (*Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) InvalidateBytesCache ¶
func (m *Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) InvalidateBytesCache()
InvalidateBytesCache invalidates the bytes cache.
func (*Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) New ¶
func (m *Mutable[OuterModelType, OuterModelPtrType, InnerModelType]) New(innerModelType *InnerModelType, cacheBytes ...bool)
New initializes the model with the necessary values when being manually created through a constructor.
type PtrType ¶
type PtrType[OuterModelType any, InnerModelType any] interface { *OuterModelType New(innerModelType *InnerModelType, cacheBytes ...bool) Init() InnerModel() *InnerModelType }
PtrType is a type constraint that ensures that all the required methods are available.
type ReferencePtrType ¶
type ReferencePtrType[OuterModelType, SourceIDType, TargetIDType any] interface { *OuterModelType New(SourceIDType, TargetIDType) Init() SourceID() SourceIDType TargetID() TargetIDType }
ReferencePtrType is a type constraint that ensures that all the required methods are available.
type ReferenceWithMetadataPtrType ¶
type ReferenceWithMetadataPtrType[OuterModelType, SourceIDType, TargetIDType, InnerModelType any] interface { *OuterModelType New(SourceIDType, TargetIDType, *InnerModelType) Init() SourceID() SourceIDType TargetID() TargetIDType InnerModel() *InnerModelType }
ReferenceWithMetadataPtrType is a type constraint that ensures that all the required methods are available.
type Storable ¶
type Storable[IDType, OuterModelType any, OuterModelPtrType PtrType[OuterModelType, InnerModelType], InnerModelType any] struct { M InnerModelType *sync.RWMutex *objectstorage.StorableObjectFlags // contains filtered or unexported fields }
Storable is the base type for all storable models. It should be embedded in a wrapper type. It provides locking and serialization primitives. Types that implement interfaces need to override the serialization logic so that the correct interface can be inferred.
func (*Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) Bytes ¶
func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) Bytes() (bytes []byte, err error)
Bytes serializes a model to a byte slice.
func (*Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) Decode ¶
func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) Decode(b []byte) (int, error)
Decode deserializes the model from a byte slice.
func (Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) Encode ¶
func (s Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) Encode() ([]byte, error)
Encode serializes the "content of the model" to a byte slice.
func (*Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) FromBytes ¶
func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) FromBytes(bytes []byte) (consumedBytes int, err error)
FromBytes deserializes a model from a byte slice.
func (*Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) FromObjectStorage ¶
func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) FromObjectStorage(key, data []byte) (err error)
FromObjectStorage deserializes a model from the object storage.
func (*Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) ID ¶
func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) ID() (id IDType)
ID returns the ID of the model.
func (*Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) IDFromBytes ¶
func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) IDFromBytes(bytes []byte) (err error)
IDFromBytes deserializes an ID from a byte slice.
func (*Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) ImportStorable ¶
func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) ImportStorable(other *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType])
ImportModel imports the model of the other storable.
func (*Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) Init ¶
func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) Init()
Init initializes the model after it has been restored from it's serialized version.
func (*Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) InnerModel ¶
func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) InnerModel() *InnerModelType
InnerModel returns the inner Model that holds the data.
func (*Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) InvalidateBytesCache ¶
func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) InvalidateBytesCache()
InvalidateBytesCache invalidates the bytes cache.
func (*Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) New ¶
func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) New(innerModelType *InnerModelType, cacheBytes ...bool)
New initializes the model with the necessary values when being manually created through a constructor.
func (*Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) ObjectStorageKey ¶
func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) ObjectStorageKey() (key []byte)
ObjectStorageKey returns the bytes, that are used as a key to store the object in the k/v store.
func (*Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) ObjectStorageValue ¶
func (s *Storable[IDType, OuterModelType, OuterModelPtrType, InnerModelType]) ObjectStorageValue() (value []byte)
ObjectStorageValue returns the bytes, that are stored in the value part of the k/v store.
type StorableReference ¶
type StorableReference[OuterModelType any, OuterModelPtrType ReferencePtrType[OuterModelType, SourceIDType, TargetIDType], SourceIDType, TargetIDType any] struct { *objectstorage.StorableObjectFlags // contains filtered or unexported fields }
StorableReference is the base type for all storable reference models. It should be embedded in a wrapper type. It provides locking and serialization primitives.
func (*StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) Bytes ¶
func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) Bytes() (bytes []byte, err error)
Bytes serializes a storable reference model to a byte slice.
func (*StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) Decode ¶
func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) Decode(b []byte) (int, error)
Decode deserializes the model from a byte slice.
func (StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) Encode ¶
func (s StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) Encode() ([]byte, error)
Encode serializes the "content of the model" to a byte slice.
func (*StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) FromBytes ¶
func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) FromBytes(bytes []byte) (consumedBytes int, err error)
FromBytes deserializes a storable reference model from a byte slice.
func (*StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) FromObjectStorage ¶
func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) FromObjectStorage(key, _ []byte) (err error)
FromObjectStorage deserializes a model from the object storage.
func (*StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) Init ¶
func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) Init()
Init initializes the storable reference model after it has been restored from it's serialized version.
func (*StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) KeyPartitions ¶
func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) KeyPartitions() []int
KeyPartitions returns a slice of the key partitions that are used to store the object in the k/v store.
func (*StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) New ¶
func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) New(sourceID SourceIDType, targetID TargetIDType)
New initializes the storable reference model with the necessary values when being manually created through a constructor.
func (*StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) ObjectStorageKey ¶
func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) ObjectStorageKey() (key []byte)
ObjectStorageKey returns the bytes, that are used as a key to store the object in the k/v store.
func (*StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) ObjectStorageValue ¶
func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) ObjectStorageValue() (value []byte)
ObjectStorageValue returns the bytes, that are stored in the value part of the k/v store.
func (*StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) SourceID ¶
func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) SourceID() SourceIDType
SourceID returns the SourceID of the storable reference model.
func (*StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) String ¶
func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) String() string
String returns a string representation of the model.
func (*StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) TargetID ¶
func (s *StorableReference[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType]) TargetID() TargetIDType
TargetID returns the TargetID of the storable reference model.
type StorableReferenceWithMetadata ¶
type StorableReferenceWithMetadata[OuterModelType any, OuterModelPtrType ReferenceWithMetadataPtrType[OuterModelType, SourceIDType, TargetIDType, InnerModelType], SourceIDType, TargetIDType, InnerModelType any] struct { M InnerModelType *sync.RWMutex *objectstorage.StorableObjectFlags // contains filtered or unexported fields }
StorableReferenceWithMetadata is the base type for all storable reference models. It should be embedded in a wrapper type. It provides locking and serialization primitives.
func (*StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) Bytes ¶
func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) Bytes() (bytes []byte, err error)
Bytes serializes a storable reference model to a byte slice.
func (*StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) Decode ¶
func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) Decode(b []byte) (int, error)
Decode deserializes the model from a byte slice.
func (StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) Encode ¶
func (s StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) Encode() ([]byte, error)
Encode serializes the "content of the model" to a byte slice.
func (*StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) FromBytes ¶
func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) FromBytes(bytes []byte) (consumedBytes int, err error)
FromBytes deserializes a storable reference model from a byte slice.
func (*StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) FromObjectStorage ¶
func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) FromObjectStorage(key, value []byte) (err error)
FromObjectStorage deserializes a model from the object storage.
func (*StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) Init ¶
func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) Init()
Init initializes the storable reference model after it has been restored from it's serialized version.
func (*StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) InnerModel ¶
func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) InnerModel() *InnerModelType
InnerModel returns the inner Model that holds the data.
func (*StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) KeyPartitions ¶
func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) KeyPartitions() []int
KeyPartitions returns a slice of the key partitions that are used to store the object in the k/v store.
func (*StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) New ¶
func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) New(sourceID SourceIDType, targetID TargetIDType, model *InnerModelType)
New initializes the storable reference model with the necessary values when being manually created through a constructor.
func (*StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) ObjectStorageKey ¶
func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) ObjectStorageKey() (key []byte)
ObjectStorageKey returns the bytes, that are used as a key to store the object in the k/v store.
func (*StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) ObjectStorageValue ¶
func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) ObjectStorageValue() (value []byte)
ObjectStorageValue returns the bytes, that are stored in the value part of the k/v store.
func (*StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) SourceID ¶
func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) SourceID() SourceIDType
SourceID returns the SourceID of the storable reference model.
func (*StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) String ¶
func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) String() string
String returns a string representation of the model.
func (*StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) TargetID ¶
func (s *StorableReferenceWithMetadata[OuterModelType, OuterModelPtrType, SourceIDType, TargetIDType, InnerModelType]) TargetID() TargetIDType
TargetID returns the TargetID of the storable reference model.