Documentation ¶
Overview ¶
Package metamngmt contains all the managment types that one needs to have in order to work with metafeeds.
This includes:
- 'metafeed/seed'
- 'metafeed/add'
- 'metafeed/announce'
- 'metafeed/tombstone'
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddDerived ¶
type AddDerived struct { Type string `json:"type"` FeedPurpose string `json:"feedpurpose"` SubFeed refs.FeedRef `json:"subfeed"` MetaFeed refs.FeedRef `json:"metafeed"` Nonce []byte `json:"nonce"` Tangles refs.Tangles `json:"tangles"` // contains filtered or unexported fields }
AddDerived links the new sub feed with the main (meta)feed using a new message on the meta feed signed by both the main feed and the meta feed.
func NewAddDerivedMessage ¶
func NewAddDerivedMessage(meta, sub refs.FeedRef, purpose string, nonce []byte) AddDerived
NewAddDerivedMessage just initializes type and the passed fields. Callers need to set the right tangle point themselves afterwards. If the message has metadata that needs to be added, function AddDerived.InsertMetadata should be used.
func (*AddDerived) GetMetadata ¶
func (derived *AddDerived) GetMetadata(key string) (string, bool)
func (*AddDerived) InsertMetadata ¶
func (derived *AddDerived) InsertMetadata(metadata map[string]string) error
InsertMetadata enhances an existing AddDerived message with metadata, returning an error if the passed metadata contains an unsupported key.
func (AddDerived) MarshalBencode ¶
func (derived AddDerived) MarshalBencode() ([]byte, error)
MarshalBencode turns an add Message into bencode bytes, using the bencode extenstions to cleanly seperate different types of string data
func (*AddDerived) UnmarshalBencode ¶
func (a *AddDerived) UnmarshalBencode(input []byte) error
UnmarshalBencode unpacks and validates all the bencode data that describe an Add message
type AddExisting ¶
type AddExisting struct { Type string `json:"type"` FeedPurpose string `json:"feedpurpose"` SubFeed refs.FeedRef `json:"subfeed"` MetaFeed refs.FeedRef `json:"metafeed"` Tangles refs.Tangles `json:"tangles"` }
AddExisting links the new sub feed with the main (meta)feed using a new message on the meta feed signed by both the main feed and the meta feed.
func NewAddExistingMessage ¶
func NewAddExistingMessage(meta, sub refs.FeedRef, purpose string) AddExisting
NewAddExistingMessage just initializes type and the passed fields. Callers need to set the right tangle point themselves afterwards.
Format of the message (in Bendy Butt binary notation, see https://github.com/ssb-ngi-pointer/bendy-butt-spec):
"type" => "metafeed/add/existing", "feedpurpose" => "main", "subfeed" => (BFE-encoded feed ID for the 'main' feed), "metafeed" => (BFE-encoded Bendy Butt feed ID for the meta feed), "tangles" => { "metafeed" => { "root" => (BFE nil), "previous" => (BFE nil) } }
func (AddExisting) MarshalBencode ¶
func (a AddExisting) MarshalBencode() ([]byte, error)
MarshalBencode turns an add Message into bencode bytes, using the bencode extenstions to cleanly seperate different types of string data
func (*AddExisting) UnmarshalBencode ¶
func (a *AddExisting) UnmarshalBencode(input []byte) error
UnmarshalBencode unpacks and validates all the bencode data that describe an Add message
type Announce ¶
type Announce struct { Type string `json:"type"` MetaFeed refs.FeedRef `json:"metafeed"` Tangles refs.Tangles `json:"tangles"` }
Announce is used in order for existing applications to know that a feed supports meta feeds. This message is created on the main feed.
type Base64String ¶
type Base64String []byte
Base64String encodes a slice of bytes as a base64 string in unicode. This is the default in go but we just want to be double sure this sticks and doesnt change under our feet in the future.
func (Base64String) MarshalJSON ¶
func (s Base64String) MarshalJSON() ([]byte, error)
MarshalJSON turns a go value into a json string.
func (*Base64String) UnmarshalJSON ¶
func (s *Base64String) UnmarshalJSON(data []byte) error
UnmarshalJSON turns json data into a go value.
type Tombstone ¶
type Tombstone struct { Type string `json:"type"` SubFeed refs.FeedRef `json:"subfeed"` MetaFeed refs.FeedRef `json:"metafeed"` Tangles refs.Tangles `json:"tangles"` }
Tombstone is used to end the lifetime of a subfeed
func NewTombstoneMessage ¶
NewTombstoneMessage returns a new Tombstone message. Callers need to set the right tangle point themselves afterwards.
func (Tombstone) MarshalBencode ¶
MarshalBencode packs an Tombstone message into bencode extended data.
func (*Tombstone) UnmarshalBencode ¶
UnmarshalBencode unpacks bencode extended data into an Tombstone message.