api

package
v0.0.0-...-eb12069 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: BSD-3-Clause Imports: 87 Imported by: 0

Documentation

Overview

Package api provides the functionality of the Bee client-facing HTTP API.

Copyright 2023 The Swarm Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Constants

View Source
const (
	SwarmPinHeader            = "Swarm-Pin"
	SwarmTagHeader            = "Swarm-Tag"
	SwarmEncryptHeader        = "Swarm-Encrypt"
	SwarmIndexDocumentHeader  = "Swarm-Index-Document"
	SwarmErrorDocumentHeader  = "Swarm-Error-Document"
	SwarmFeedIndexHeader      = "Swarm-Feed-Index"
	SwarmFeedIndexNextHeader  = "Swarm-Feed-Index-Next"
	SwarmCollectionHeader     = "Swarm-Collection"
	SwarmPostageBatchIdHeader = "Swarm-Postage-Batch-Id"
	SwarmDeferredUploadHeader = "Swarm-Deferred-Upload"

	ImmutableHeader = "Immutable"
	GasPriceHeader  = "Gas-Price"
	GasLimitHeader  = "Gas-Limit"
	ETagHeader      = "ETag"

	AuthorizationHeader      = "Authorization"
	AcceptEncodingHeader     = "Accept-Encoding"
	ContentTypeHeader        = "Content-Type"
	ContentDispositionHeader = "Content-Disposition"
	ContentLengthHeader      = "Content-Length"
	RangeHeader              = "Range"
	OriginHeader             = "Origin"
)

Variables

View Source
var DebugVersion = "0.0.0"
View Source
var Version = "0.0.0"

Version is set in the build process.

Functions

This section is empty.

Types

type BeeNodeMode

type BeeNodeMode uint
const (
	UnknownMode BeeNodeMode = iota
	LightMode
	FullMode
	DevMode
	UltraLightMode
)

func (BeeNodeMode) String

func (b BeeNodeMode) String() string

type BlockListedPeer

type BlockListedPeer struct {
	Peer
	Reason   string `json:"reason"`
	Duration int    `json:"duration"`
}

type ExtraOptions

type ExtraOptions struct {
	Pingpong        pingpong.Interface
	TopologyDriver  topology.Driver
	LightNodes      *lightnode.Container
	Accounting      accounting.Interface
	Pseudosettle    settlement.Interface
	Swap            swap.Interface
	Chequebook      chequebook.Service
	BlockTime       time.Duration
	Storer          Storer
	Resolver        resolver.Interface
	Pss             pss.Interface
	FeedFactory     feeds.Factory
	Post            postage.Service
	PostageContract postagecontract.Interface
	Staking         staking.Contract
	Steward         steward.Interface
	SyncStatus      func() (bool, error)
	NodeStatus      *status.Service
}

type FileInfo

type FileInfo struct {
	Path        string
	Name        string
	ContentType string
	Size        int64
	Reader      io.Reader
}

type Options

type Options struct {
	CORSAllowedOrigins []string
	WsPingPeriod       time.Duration
	Restricted         bool
}

type Peer

type Peer struct {
	Address  swarm.Address `json:"address"`
	FullNode bool          `json:"fullNode"`
}

Peer holds information about a Peer.

type Probe

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

Probe structure holds flags which indicate node healthiness (sometimes refert also as liveness) and readiness.

func NewProbe

func NewProbe() *Probe

NewProbe returns new Probe.

func (*Probe) Healthy

func (p *Probe) Healthy() ProbeStatus

Healthy returns the value of the healthy status.

func (*Probe) Ready

func (p *Probe) Ready() ProbeStatus

Ready returns the value of the ready status.

func (*Probe) SetHealthy

func (p *Probe) SetHealthy(ps ProbeStatus)

SetHealthy updates the value of the healthy status.

func (*Probe) SetReady

func (p *Probe) SetReady(ps ProbeStatus)

SetReady updates the value of the ready status.

type ProbeStatus

type ProbeStatus int32

ProbeStatus is the status of a probe. ProbeStatus is treated as a sync/atomic int32.

const (
	// ProbeStatusOK indicates positive ProbeStatus status.
	ProbeStatusOK ProbeStatus = 1

	// ProbeStatusNOK indicates negative ProbeStatus status.
	ProbeStatusNOK ProbeStatus = 0
)

func (ProbeStatus) String

func (ps ProbeStatus) String() string

String implements the fmt.Stringer interface.

type Service

type Service struct {
	Options

	http.Handler
	// contains filtered or unexported fields
}

func New

func New(
	publicKey, pssPublicKey ecdsa.PublicKey,
	ethereumAddress common.Address,
	logger log.Logger,
	transaction transaction.Service,
	batchStore postage.Storer,
	beeMode BeeNodeMode,
	chequebookEnabled bool,
	swapEnabled bool,
	chainBackend transaction.Backend,
	cors []string,
	stamperStore storage.Store,
) *Service

func (*Service) Close

func (s *Service) Close() error

Close hangs up running websockets on shutdown.

func (*Service) Configure

func (s *Service) Configure(signer crypto.Signer, auth auth.Authenticator, tracer *tracing.Tracer, o Options, e ExtraOptions, chainID int64, erc20 erc20.Service)

Configure will create a and initialize a new API service.

func (*Service) Metrics

func (s *Service) Metrics() []prometheus.Collector

func (*Service) MetricsRegistry

func (s *Service) MetricsRegistry() *prometheus.Registry

func (*Service) MountAPI

func (s *Service) MountAPI()

func (*Service) MountDebug

func (s *Service) MountDebug(restricted bool)

func (*Service) MountTechnicalDebug

func (s *Service) MountTechnicalDebug()

func (*Service) MustRegisterMetrics

func (s *Service) MustRegisterMetrics(cs ...prometheus.Collector)

func (*Service) SetP2P

func (s *Service) SetP2P(p2p p2p.DebugService)

func (*Service) SetProbe

func (s *Service) SetProbe(probe *Probe)

func (*Service) SetRedistributionAgent

func (s *Service) SetRedistributionAgent(redistributionAgent *storageincentives.Agent)

func (*Service) SetSwarmAddress

func (s *Service) SetSwarmAddress(addr *swarm.Address)

type Storer

Storer interface provides the functionality required from the local storage component of the node.

type UpgradedResponseWriter

type UpgradedResponseWriter interface {
	http.ResponseWriter
	http.Pusher
	http.Hijacker
	http.Flusher
	// staticcheck SA1019 CloseNotifier interface is required by gorilla compress handler
	// nolint:staticcheck
	http.CloseNotifier
}

UpgradedResponseWriter adds more functionality on top of ResponseWriter

Jump to

Keyboard shortcuts

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