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 PoolMetadataFields ¶ added in v0.69.0
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
}