multimsg

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2021 License: MIT Imports: 12 Imported by: 1

Documentation

Overview

Package multimsg implements a margaret codec to encode multiple kinds of messages to disk. Currently _legacy_ and _gabbygrove_ but should be easily extendable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlterableLog

type AlterableLog interface {
	margaret.Log
	margaret.Alterer
	io.Closer
}

type MargaretCodec

type MargaretCodec struct{}

func (MargaretCodec) Marshal

func (c MargaretCodec) Marshal(v interface{}) ([]byte, error)

func (MargaretCodec) NewDecoder

func (c MargaretCodec) NewDecoder(r io.Reader) margaret.Decoder

func (MargaretCodec) NewEncoder

func (c MargaretCodec) NewEncoder(w io.Writer) margaret.Encoder

func (MargaretCodec) Unmarshal

func (c MargaretCodec) Unmarshal(data []byte) (interface{}, error)

type MessageType

type MessageType byte
const (
	Unknown MessageType = iota
	Legacy
	Gabby
	MetaFeed
)

type MultiMessage

type MultiMessage struct {
	refs.Message
	// contains filtered or unexported fields
}

MultiMessage attempts to support multiple message formats in the same storage layer currently supports Proto and legacy

func NewMultiMessageFromKeyValRaw added in v0.2.1

func NewMultiMessageFromKeyValRaw(msg refs.KeyValueRaw, raw json.RawMessage) MultiMessage

func NewMultiMessageFromLegacy

func NewMultiMessageFromLegacy(msg *legacy.StoredMessage) *MultiMessage

func (MultiMessage) AsGabby

func (mm MultiMessage) AsGabby() (*gabbygrove.Transfer, bool)

func (MultiMessage) AsLegacy

func (mm MultiMessage) AsLegacy() (*legacy.StoredMessage, bool)

func (MultiMessage) AsMetaFeed added in v0.2.1

func (mm MultiMessage) AsMetaFeed() (*metafeed.Message, bool)

func (MultiMessage) MarshalBinary

func (mm MultiMessage) MarshalBinary() ([]byte, error)

func (MultiMessage) Received

func (mm MultiMessage) Received() time.Time

func (*MultiMessage) UnmarshalBinary

func (mm *MultiMessage) UnmarshalBinary(data []byte) error

type WrappedLog

type WrappedLog struct {
	AlterableLog
	// contains filtered or unexported fields
}

func NewWrappedLog

func NewWrappedLog(in AlterableLog) *WrappedLog

func (WrappedLog) Append

func (wl WrappedLog) Append(val interface{}) (int64, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL