Documentation
¶
Index ¶
- Constants
- func ApproverFromStorageKey(key []byte, optionalTargetObject ...*Approver) (result objectstorage.StorableObject, consumedBytes int, err error)
- func MessageMetadataFromStorageKey(key []byte) (result objectstorage.StorableObject, consumedBytes int, err error)
- func MissingMessageFromStorageKey(key []byte, optionalTargetObject ...*MissingMessage) (result objectstorage.StorableObject, consumedBytes int, err error)
- type Approver
- func ApproverFromBytes(bytes []byte, optionalTargetObject ...*Approver) (result *Approver, err error, consumedBytes int)
- func NewApprover(referencedMessageId message.Id, approverMessageId message.Id) *Approver
- func ParseApprover(marshalUtil *marshalutil.MarshalUtil, optionalTargetObject ...*Approver) (result *Approver, err error)
- func (approver *Approver) ApproverMessageId() message.Id
- func (approver *Approver) Bytes() []byte
- func (approver *Approver) ObjectStorageKey() []byte
- func (approver *Approver) ObjectStorageValue() (result []byte)
- func (approver *Approver) ReferencedMessageId() message.Id
- func (approver *Approver) String() string
- func (approver *Approver) UnmarshalObjectStorageValue(data []byte) (consumedBytes int, err error)
- func (approver *Approver) Update(other objectstorage.StorableObject)
- type CachedApprover
- type CachedApprovers
- type CachedMessageMetadata
- type Events
- type MessageMetadata
- func (messageMetadata *MessageMetadata) IsSolid() (result bool)
- func (messageMetadata *MessageMetadata) ObjectStorageKey() []byte
- func (messageMetadata *MessageMetadata) ObjectStorageValue() []byte
- func (messageMetadata *MessageMetadata) SetSolid(solid bool) (modified bool)
- func (messageMetadata *MessageMetadata) SolidificationTime() time.Time
- func (messageMetadata *MessageMetadata) UnmarshalObjectStorageValue(data []byte) (consumedBytes int, err error)
- func (messageMetadata *MessageMetadata) Update(other objectstorage.StorableObject)
- type MissingMessage
- func (missingMessage *MissingMessage) MessageId() message.Id
- func (missingMessage *MissingMessage) MissingSince() time.Time
- func (missingMessage *MissingMessage) ObjectStorageKey() []byte
- func (missingMessage *MissingMessage) ObjectStorageValue() (result []byte)
- func (missingMessage *MissingMessage) UnmarshalObjectStorageValue(data []byte) (consumedBytes int, err error)
- func (missingMessage *MissingMessage) Update(other objectstorage.StorableObject)
- type Tangle
- func (tangle *Tangle) Approvers(messageId message.Id) CachedApprovers
- func (tangle *Tangle) AttachMessage(msg *message.Message)
- func (tangle *Tangle) DeleteMessage(messageId message.Id)
- func (tangle *Tangle) Message(messageId message.Id) *message.CachedMessage
- func (tangle *Tangle) MessageMetadata(messageId message.Id) *CachedMessageMetadata
- func (tangle *Tangle) MonitorMissingMessages(shutdownSignal <-chan struct{})
- func (tangle *Tangle) Prune() error
- func (tangle *Tangle) Shutdown() *Tangle
Constants ¶
const ( PrefixMessage byte = iota PrefixMessageMetadata PrefixApprovers PrefixMissingMessage )
const ( // MaxMissingTimeBeforeCleanup is the max. amount of time a message can be marked as missing // before it is ultimately un-marked as missing. MaxMissingTimeBeforeCleanup = 30 * time.Second // MissingCheckInterval is the interval on which it is checked whether a missing // message is still missing. MissingCheckInterval = 5 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func ApproverFromStorageKey ¶
func ApproverFromStorageKey(key []byte, optionalTargetObject ...*Approver) (result objectstorage.StorableObject, consumedBytes int, err error)
ApproverFromStorageKey returns an approver for the given key.
func MessageMetadataFromStorageKey ¶
func MessageMetadataFromStorageKey(key []byte) (result objectstorage.StorableObject, consumedBytes int, err error)
func MissingMessageFromStorageKey ¶
func MissingMessageFromStorageKey(key []byte, optionalTargetObject ...*MissingMessage) (result objectstorage.StorableObject, consumedBytes int, err error)
Types ¶
type Approver ¶
type Approver struct { objectstorage.StorableObjectFlags // contains filtered or unexported fields }
Approver is an approver of a given referenced message.
func ApproverFromBytes ¶
func ApproverFromBytes(bytes []byte, optionalTargetObject ...*Approver) (result *Approver, err error, consumedBytes int)
ApproverFromBytes parses the given bytes into an approver.
func NewApprover ¶
NewApprover creates a new approver relation to the given approved/referenced message.
func ParseApprover ¶
func ParseApprover(marshalUtil *marshalutil.MarshalUtil, optionalTargetObject ...*Approver) (result *Approver, err error)
ParseApprover parses a new approver from the given marshal util.
func (*Approver) ApproverMessageId ¶
ApproverMessageId returns the id of the message which referenced the given approved message.
func (*Approver) ObjectStorageKey ¶
func (*Approver) ObjectStorageValue ¶
func (*Approver) ReferencedMessageId ¶
ReferencedMessageId returns the id of the message which is referenced by the approver.
func (*Approver) UnmarshalObjectStorageValue ¶
func (*Approver) Update ¶
func (approver *Approver) Update(other objectstorage.StorableObject)
type CachedApprover ¶
type CachedApprover struct {
objectstorage.CachedObject
}
func (*CachedApprover) Consume ¶
func (cachedApprover *CachedApprover) Consume(consumer func(approver *Approver)) (consumed bool)
func (*CachedApprover) Unwrap ¶
func (cachedApprover *CachedApprover) Unwrap() *Approver
type CachedApprovers ¶
type CachedApprovers []*CachedApprover
func (CachedApprovers) Consume ¶
func (cachedApprovers CachedApprovers) Consume(consumer func(approver *Approver)) (consumed bool)
type CachedMessageMetadata ¶
type CachedMessageMetadata struct {
objectstorage.CachedObject
}
func (*CachedMessageMetadata) Retain ¶
func (cachedMessageMetadata *CachedMessageMetadata) Retain() *CachedMessageMetadata
func (*CachedMessageMetadata) Unwrap ¶
func (cachedMessageMetadata *CachedMessageMetadata) Unwrap() *MessageMetadata
type Events ¶
type Events struct { // Fired when a message has been attached. MessageAttached *events.Event // Fired when a message has been solid, i.e. its past cone // is known and in the database. MessageSolid *events.Event // Fired when a message which was previously marked as missing was received. MissingMessageReceived *events.Event // Fired when a message is missing which is needed to solidify a given approver message. MessageMissing *events.Event // Fired when a message was missing for too long and is // therefore considered to be unsolidifiable. MessageUnsolidifiable *events.Event // Fired when a message was removed from storage. MessageRemoved *events.Event }
Events represents events happening on the base layer Tangle.
type MessageMetadata ¶
type MessageMetadata struct { objectstorage.StorableObjectFlags // contains filtered or unexported fields }
func MessageMetadataFromBytes ¶
func MessageMetadataFromBytes(bytes []byte) (result *MessageMetadata, err error, consumedBytes int)
func NewMessageMetadata ¶
func NewMessageMetadata(messageId message.Id) *MessageMetadata
func ParseMessageMetadata ¶
func ParseMessageMetadata(marshalUtil *marshalutil.MarshalUtil) (result *MessageMetadata, err error)
func (*MessageMetadata) IsSolid ¶
func (messageMetadata *MessageMetadata) IsSolid() (result bool)
func (*MessageMetadata) ObjectStorageKey ¶
func (messageMetadata *MessageMetadata) ObjectStorageKey() []byte
func (*MessageMetadata) ObjectStorageValue ¶
func (messageMetadata *MessageMetadata) ObjectStorageValue() []byte
func (*MessageMetadata) SetSolid ¶
func (messageMetadata *MessageMetadata) SetSolid(solid bool) (modified bool)
func (*MessageMetadata) SolidificationTime ¶
func (messageMetadata *MessageMetadata) SolidificationTime() time.Time
SolidificationTime returns the time when the message was marked to be solid.
func (*MessageMetadata) UnmarshalObjectStorageValue ¶
func (messageMetadata *MessageMetadata) UnmarshalObjectStorageValue(data []byte) (consumedBytes int, err error)
func (*MessageMetadata) Update ¶
func (messageMetadata *MessageMetadata) Update(other objectstorage.StorableObject)
type MissingMessage ¶
type MissingMessage struct { objectstorage.StorableObjectFlags // contains filtered or unexported fields }
func NewMissingMessage ¶
func NewMissingMessage(messageId message.Id) *MissingMessage
func (*MissingMessage) MessageId ¶
func (missingMessage *MissingMessage) MessageId() message.Id
MessageId returns the id of the message.
func (*MissingMessage) MissingSince ¶
func (missingMessage *MissingMessage) MissingSince() time.Time
MissingSince returns the time since when this message is missing.
func (*MissingMessage) ObjectStorageKey ¶
func (missingMessage *MissingMessage) ObjectStorageKey() []byte
func (*MissingMessage) ObjectStorageValue ¶
func (missingMessage *MissingMessage) ObjectStorageValue() (result []byte)
func (*MissingMessage) UnmarshalObjectStorageValue ¶
func (missingMessage *MissingMessage) UnmarshalObjectStorageValue(data []byte) (consumedBytes int, err error)
func (*MissingMessage) Update ¶
func (missingMessage *MissingMessage) Update(other objectstorage.StorableObject)
type Tangle ¶
type Tangle struct { Events Events // contains filtered or unexported fields }
Tangle represents the base layer of messages.
func (*Tangle) Approvers ¶
func (tangle *Tangle) Approvers(messageId message.Id) CachedApprovers
Approvers retrieves the approvers of a message from the tangle.
func (*Tangle) AttachMessage ¶
AttachMessage attaches a new message to the tangle.
func (*Tangle) DeleteMessage ¶
DeleteMessage deletes a message and its association to approvees by un-marking the given message as an approver.
func (*Tangle) Message ¶
func (tangle *Tangle) Message(messageId message.Id) *message.CachedMessage
Message retrieves a message from the tangle.
func (*Tangle) MessageMetadata ¶
func (tangle *Tangle) MessageMetadata(messageId message.Id) *CachedMessageMetadata
MessageMetadata retrieves the metadata of a message from the tangle.
func (*Tangle) MonitorMissingMessages ¶
func (tangle *Tangle) MonitorMissingMessages(shutdownSignal <-chan struct{})
MonitorMissingMessages continuously monitors for missing messages and eventually deletes them if they don't become available in a certain time frame.