pool

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TopicName = "dag-time-pool"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

Pool manages the temporary event pool

func NewPool

func NewPool(ctx context.Context, h host.Host) (*Pool, error)

NewPool creates a new temporary event pool

func (*Pool) AddEvent

func (p *Pool) AddEvent(ctx context.Context, data []byte, parents []string) error

AddEvent adds a new event to the pool and broadcasts it

func (*Pool) AddSubEvent

func (p *Pool) AddSubEvent(ctx context.Context, data []byte, parentEventID string, additionalParents []string) error

AddSubEvent adds a new sub-event to the pool with optional connections to other sub-events

func (*Pool) Close

func (p *Pool) Close() error

Close shuts down the pool

func (*Pool) GetEvent

func (p *Pool) GetEvent(id string) (*dag.Event, error)

GetEvent retrieves a specific event by ID

func (*Pool) GetEvents

func (p *Pool) GetEvents() []*dag.Event

GetEvents returns all events in the pool

func (*Pool) GetHost

func (p *Pool) GetHost() host.Host

GetHost returns the libp2p host for testing purposes

func (*Pool) GetPeers

func (p *Pool) GetPeers() map[peer.ID]time.Time

GetPeers returns all known peers and their last seen time

func (*Pool) VerifyEvent

func (p *Pool) VerifyEvent(eventID string) error

VerifyEvent verifies an event and its chain of ancestors

Jump to

Keyboard shortcuts

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