event

package
v0.0.0-...-fb5f67a Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal[T any](event Event[T], dataUnbinder node.Unbinder[T]) ([]byte, error)

Marshal serializes an Event to CBOR encoded bytes.

func MarshalBlock

func MarshalBlock[T any](e Event[T], dataUnbinder node.Unbinder[T]) (block.BlockView[Event[T]], error)

MarshalBlock serializes the Event to CBOR encoded bytes, takes the sha2-256 hash of the data, constructs a CID and returns a block.Block.

Types

type BlockView

type BlockView[T any] interface {
	block.BlockView[Event[T]]
}

type Event

type Event[T any] interface {
	Parents() []ipld.Link
	Data() T
}

func NewEvent

func NewEvent[T any](data T, parents []ipld.Link) Event[T]

func Unmarshal

func Unmarshal[T any](b []byte, dataBinder node.Binder[T]) (Event[T], error)

Unmarshal deserializes CBOR encoded bytes to an Event.

type Fetcher

type Fetcher[T any] struct {
	// contains filtered or unexported fields
}

func NewFetcher

func NewFetcher[T any](blocks block.Fetcher, dataBinder node.Binder[T]) *Fetcher[T]

func (*Fetcher[T]) Get

func (f *Fetcher[T]) Get(ctx context.Context, link ipld.Link) (BlockView[T], error)

Jump to

Keyboard shortcuts

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