backend

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

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

func NewBackend

func NewBackend(eventLog EventLog, ipfs IpfsShell, eth EthShell, accountAddress string) *Backend

func (*Backend) FindConfirmedEvents

func (b *Backend) FindConfirmedEvents() ([]eventlog.Event, error)

func (*Backend) FindPendingEvents

func (b *Backend) FindPendingEvents() ([]eventlog.Event, error)

func (*Backend) PublishEvent

func (b *Backend) PublishEvent(publishRequest PublishRequest) (eventlog.Event, error)

func (*Backend) SubscribeToEvents

func (b *Backend) SubscribeToEvents(ctx context.Context) error

func (*Backend) SynchroniseAllTopics

func (b *Backend) SynchroniseAllTopics(ctx context.Context) error

type EthShell

type EthShell interface {
	PublishEvent(ctx context.Context, topic string, id uuid.UUID, cid string, newAccounts []string) (*types.Transaction, common.Address, error)
	GetTopics(ctx context.Context) ([]string, error)
	GetEvents(topic string, fromBlock uint64) ([]ethshell.EventLogEvent, error)
	SubscribeToEvents(ctx context.Context) (ethereum.Subscription, chan types.Log, error)
	UnpackLog(ctx context.Context, log types.Log) (ethshell.EventLogEvent, error)
}

type EventLog

type EventLog interface {
	Insert(event eventlog.Event) (eventlog.Event, error)
	ResetFromBlockAndInsert(topic string, lastBlockNumber uint64, events []eventlog.Event) error
	FindLastSynchronisedBlockNumber(topic string) (uint64, error)
	FindPendingEvents() ([]eventlog.Event, error)
	FindConfirmedEvents() ([]eventlog.Event, error)
	Confirm(id uuid.UUID, blockNumber uint64, timestamp uint64) (eventlog.Event, error)
	ClearPendingEvents(topic string) error
}

type IpfsShell

type IpfsShell interface {
	PublishBusinessEvent(businessEvent ipfsshell.BusinessEvent) (string, error)
	GetBusinessEvent(cid string) (ipfsshell.BusinessEvent, error)
}

type PublishRequest

type PublishRequest struct {
	Type        string
	Payload     string
	Version     float64
	Topic       string
	NewAccounts []string
}

Jump to

Keyboard shortcuts

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