synchronizer

package
v0.0.0-...-9dc60ae Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBatchSize = 10
View Source
const ErrorSendingRequest = `` /* 200-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type CleanSynchronizer

type CleanSynchronizer struct {
	SynchronizerRepository *repository.SynchronizerRepository
	Period                 time.Duration
}

func NewCleanSynchronizer

func NewCleanSynchronizer(
	SynchronizerRepository *repository.SynchronizerRepository,
	period *time.Duration,
) *CleanSynchronizer

func (CleanSynchronizer) Start

func (x CleanSynchronizer) Start(ctx context.Context, ready chan<- struct{}) error

func (CleanSynchronizer) String

func (x CleanSynchronizer) String() string

type InputRef

type InputRef struct {
	Index int `json:"index"`
}

type OutputValidityProof

type OutputValidityProof struct {
	InputIndexWithinEpoch            int      `json:"inputIndexWithinEpoch"`
	OutputIndexWithinInput           int      `json:"outputIndexWithinInput"`
	OutputHashesRootHash             string   `json:"outputHashesRootHash"`
	VouchersEpochRootHash            string   `json:"vouchersEpochRootHash"`
	NoticesEpochRootHash             string   `json:"noticesEpochRootHash"`
	MachineStateHash                 string   `json:"machineStateHash"`
	OutputHashInOutputHashesSiblings []string `json:"outputHashInOutputHashesSiblings"`
	OutputHashesInEpochSiblings      []string `json:"outputHashesInEpochSiblings"`
}

type PageInfo

type PageInfo struct {
	StartCursor     string `json:"startCursor"`
	EndCursor       string `json:"endCursor"`
	HasNextPage     bool   `json:"hasNextPage"`
	HasPreviousPage bool   `json:"hasPreviousPage"`
}

type Proof

type Proof struct {
	Validity OutputValidityProof `json:"validity"`
	Context  string              `json:"context"`
}

type Synchronizer

type Synchronizer struct {
	VoucherFetcher         *VoucherFetcher
	SynchronizerRepository *repository.SynchronizerRepository
	// contains filtered or unexported fields
}

func NewSynchronizer

func NewSynchronizer(
	decoder *decoder.OutputDecoder,
	voucherFetcher *VoucherFetcher,
	SynchronizerRepository *repository.SynchronizerRepository,
) *Synchronizer

func (Synchronizer) Start

func (x Synchronizer) Start(ctx context.Context, ready chan<- struct{}) error

func (Synchronizer) String

func (x Synchronizer) String() string

String implements supervisor.Worker.

func (*Synchronizer) VoucherPolling

func (x *Synchronizer) VoucherPolling(ctx context.Context) error

type Voucher

type Voucher struct {
	Index       int      `json:"index"`
	Destination string   `json:"destination"`
	Payload     string   `json:"payload"`
	Proof       Proof    `json:"proof"`
	Input       InputRef `json:"input"`
}

type VoucherConnection

type VoucherConnection struct {
	TotalCount int           `json:"totalCount"`
	Edges      []VoucherEdge `json:"edges"`
	PageInfo   PageInfo      `json:"pageInfo"`
}

type VoucherData

type VoucherData struct {
	Vouchers VoucherConnection `json:"vouchers"`
}

type VoucherEdge

type VoucherEdge struct {
	Node   Voucher `json:"node"`
	Cursor string  `json:"cursor"`
}

type VoucherFetcher

type VoucherFetcher struct {
	Url         string
	CursorAfter string
	BatchSize   int
	Query       string
}

func NewVoucherFetcher

func NewVoucherFetcher() *VoucherFetcher

func (*VoucherFetcher) Fetch

func (v *VoucherFetcher) Fetch() (*VoucherResponse, error)

type VoucherResponse

type VoucherResponse struct {
	Data VoucherData `json:"data"`
}

Jump to

Keyboard shortcuts

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