core

package
v0.0.0-...-414a959 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2017 License: AGPL-3.0 Imports: 46 Imported by: 0

README

API

Idempotency

Most of the API endpoints are idempotent. Some endpoints require a client_token parameter that is used for ensuring idempotency. These client tokens are only used as an idempotency key, and cannot be used to lookup entities later.

Documentation

Overview

Package core implements Chain Core and its API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupSubmittedTxs

func CleanupSubmittedTxs(ctx context.Context, db pg.DB)

CleanupSubmittedTxs will periodically delete records of submitted txs older than a day. This function blocks and only exits when its context is cancelled.

TODO(jackson): unexport this and start it in a goroutine in a core.New() function?

func WriteHTTPError

func WriteHTTPError(ctx context.Context, w http.ResponseWriter, err error)

WriteHTTPError writes a json encoded detailedError to the ResponseWriter. It uses the status code associated with the error.

Types

type Handler

type Handler struct {
	Chain         *protocol.Chain
	Store         *txdb.Store
	PinStore      *pin.Store
	Assets        *asset.Registry
	Accounts      *account.Manager
	HSM           *mockhsm.HSM
	Indexer       *query.Indexer
	TxFeeds       *txfeed.Tracker
	AccessTokens  *accesstoken.CredentialStore
	Config        *config.Config
	Submitter     txbuilder.Submitter
	DB            pg.DB
	Addr          string
	AltAuth       func(*http.Request) bool
	Signer        func(context.Context, *bc.Block) ([]byte, error)
	RequestLimits []RequestLimit
	// contains filtered or unexported fields
}

Handler serves the Chain HTTP API

func (*Handler) HealthSetter

func (h *Handler) HealthSetter(name string) func(error)

HealthSetter returns a function that, when called, sets the named health status in the map returned by "/health". The returned function is safe to call concurrently with ServeHTTP.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RequestLimit

type RequestLimit struct {
	Key       func(*http.Request) string
	Burst     int
	PerSecond int
}

Directories

Path Synopsis
Package accesstoken provides storage and validation of Chain Core credentials.
Package accesstoken provides storage and validation of Chain Core credentials.
Package account stores and tracks accounts within a Chain Core.
Package account stores and tracks accounts within a Chain Core.
Package asset maintains a registry of all assets on a blockchain.
Package asset maintains a registry of all assets on a blockchain.
Package blocksigner implements remote block signing.
Package blocksigner implements remote block signing.
Package config manages persistent configuration data for Chain Core.
Package config manages persistent configuration data for Chain Core.
Package coretest provides utilities for testing Chain Core.
Package coretest provides utilities for testing Chain Core.
Package coreunsafe contains Core logic that is unsafe for production.
Package coreunsafe contains Core logic that is unsafe for production.
Package fetch implements block replication for participant Chain Cores.
Package fetch implements block replication for participant Chain Cores.
Package generator implements the Chain Core generator.
Package generator implements the Chain Core generator.
Package leader implements leader election between cored processes of a Chain Core.
Package leader implements leader election between cored processes of a Chain Core.
Package migrate implements database migration for Chain Core.
Package migrate implements database migration for Chain Core.
Package mockhsm provides a mock HSM for development environments.
Package mockhsm provides a mock HSM for development environments.
Package query implements indexing and querying of annotated blockchain data.
Package query implements indexing and querying of annotated blockchain data.
filter
Package filter parses and evaluates Chain filter expressions.
Package filter parses and evaluates Chain filter expressions.
Package rpc implements Chain Core's RPC client.
Package rpc implements Chain Core's RPC client.
Package signers associates signers and their corresponding keys.
Package signers associates signers and their corresponding keys.
Package txbuilder builds a Chain Protocol transaction from a list of actions.
Package txbuilder builds a Chain Protocol transaction from a list of actions.
Package txdb provides storage for Chain Protocol blockchain data structures.
Package txdb provides storage for Chain Protocol blockchain data structures.
internal/storage
Package storage is a generated protocol buffer package.
Package storage is a generated protocol buffer package.
Package txfeed implements Chain Core's transaction feeds.
Package txfeed implements Chain Core's transaction feeds.

Jump to

Keyboard shortcuts

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