offchainmetadata

package
v0.70.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Logger *slog.Logger
	Store  Store
	// HTTPClient customizes fetch requests. When private addresses are not
	// allowed, New clones the client and replaces unsafe transport dial hooks.
	HTTPClient            *http.Client
	Interval              time.Duration
	RequestTimeout        time.Duration
	UserAgent             string
	IPFSGatewayURL        string
	BatchSize             int
	MaxBytes              int64
	AllowPrivateAddresses bool
}

type Fetcher

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

func New

func New(cfg Config) (*Fetcher, error)

func (*Fetcher) Start

func (f *Fetcher) Start(ctx context.Context) error

func (*Fetcher) Stop

func (f *Fetcher) Stop(ctx context.Context) error

type PoolMetadataFields added in v0.69.0

type PoolMetadataFields struct {
	Name        string
	Description string
	Ticker      string
	Homepage    string
}

PoolMetadataFields holds the decoded fields of a validated stake pool off-chain metadata document.

func ValidatePoolMetadata added in v0.69.0

func ValidatePoolMetadata(raw []byte) (*PoolMetadataFields, error)

ValidatePoolMetadata decodes and validates raw as Cardano stake-pool off-chain metadata. It mirrors cardano-api's validateAndHashStakePoolMetadata: the document must be at most 512 bytes, and must decode as a JSON object carrying required "name" (<=50 characters), "description" (<=255 characters), "ticker" (3-5 characters), and "homepage" (required, unbounded length) string fields.

A size violation is reported with the models.OffchainFetchErrBodyTooLargePrefix prefix; any other validation failure (JSON syntax, wrong JSON type, a missing/null required field, or a field failing its length constraint) is reported with the models.OffchainFetchErrDecodeErrorPrefix prefix. Callers classify the failure the same way readLimited's size errors are classified, by inspecting the returned error's message prefix.

type Store

type Store interface {
	EnsureOffchainMetadataPointers(
		ctx context.Context,
		now time.Time,
		txn types.Txn,
	) (int, error)
	GetOffchainMetadataFetchBatch(
		ctx context.Context,
		limit int,
		now time.Time,
		txn types.Txn,
	) ([]models.OffchainMetadata, error)
	SetOffchainMetadataFetchResult(
		ctx context.Context,
		doc *models.OffchainMetadata,
		txn types.Txn,
	) error
}

Jump to

Keyboard shortcuts

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