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
- Variables
- func CalculateNumberOfChunks(contentLength int64, isEncrypted bool) int64
- type BeeNodeMode
- type BlockListedPeer
- type ChunkInclusionProof
- type ChunkInclusionProofs
- type ExtraOptions
- type FileInfo
- type GranteesPatch
- type GranteesPatchRequest
- type GranteesPatchResponse
- type GranteesPostRequest
- type GranteesPostResponse
- type Options
- type Peer
- type PinIntegrity
- type PinIntegrityResponse
- type PostageProof
- type Probe
- type ProbeStatus
- type RCHashResponse
- type SOCProof
- type Service
- func (s *Service) Close() error
- func (s *Service) Configure(signer crypto.Signer, tracer *tracing.Tracer, o Options, e ExtraOptions, ...)
- func (s *Service) Metrics() []prometheus.Collector
- func (s *Service) MetricsRegistry() *prometheus.Registry
- func (s *Service) MountAPI()
- func (s *Service) MountDebug()
- func (s *Service) MountTechnicalDebug()
- func (s *Service) MustRegisterMetrics(cs ...prometheus.Collector)
- func (s *Service) SetP2P(p2p p2p.DebugService)
- func (s *Service) SetProbe(probe *Probe)
- func (s *Service) SetRedistributionAgent(redistributionAgent *storageincentives.Agent)
- func (s *Service) SetSwarmAddress(addr *swarm.Address)
- type Storer
- type UpgradedResponseWriter
Constants ¶
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" SwarmPostageStampHeader = "Swarm-Postage-Stamp" SwarmDeferredUploadHeader = "Swarm-Deferred-Upload" SwarmRedundancyLevelHeader = "Swarm-Redundancy-Level" SwarmRedundancyStrategyHeader = "Swarm-Redundancy-Strategy" SwarmRedundancyFallbackModeHeader = "Swarm-Redundancy-Fallback-Mode" SwarmChunkRetrievalTimeoutHeader = "Swarm-Chunk-Retrieval-Timeout" SwarmLookAheadBufferSizeHeader = "Swarm-Lookahead-Buffer-Size" SwarmActHeader = "Swarm-Act" SwarmActTimestampHeader = "Swarm-Act-Timestamp" SwarmActPublisherHeader = "Swarm-Act-Publisher" SwarmActHistoryAddressHeader = "Swarm-Act-History-Address" 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 ¶
var Version = "0.0.0"
Version is set in the build process.
Functions ¶
func CalculateNumberOfChunks ¶
CalculateNumberOfChunks calculates the number of chunks in an arbitrary content length.
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 ChunkInclusionProof ¶
type ChunkInclusionProof struct { ProofSegments []string `json:"proofSegments"` ProveSegment string `json:"proveSegment"` ProofSegments2 []string `json:"proofSegments2"` ProveSegment2 string `json:"proveSegment2"` ChunkSpan uint64 `json:"chunkSpan"` ProofSegments3 []string `json:"proofSegments3"` PostageProof PostageProof `json:"postageProof"` SocProof []SOCProof `json:"socProof"` }
ChunkInclusionProof structure must exactly match corresponding structure (of the same name) in Redistribution.sol smart contract. github.com/ethersphere/storage-incentives/blob/ph_f2/src/Redistribution.sol github.com/ethersphere/storage-incentives/blob/master/src/Redistribution.sol (when merged to master)
type ChunkInclusionProofs ¶
type ChunkInclusionProofs struct { A ChunkInclusionProof `json:"proof1"` B ChunkInclusionProof `json:"proof2"` C ChunkInclusionProof `json:"proofLast"` }
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 AccessControl accesscontrol.Controller PostageContract postagecontract.Interface Staking staking.Contract Steward steward.Interface SyncStatus func() (bool, error) NodeStatus *status.Service PinIntegrity PinIntegrity }
type GranteesPatch ¶ added in v2.2.0
type GranteesPatch struct { // Addlist is a list of ecdsa.PublicKeys to be added to a grantee list. Addlist []*ecdsa.PublicKey // Revokelist is a list of ecdsa.PublicKeys to be removed from a grantee list Revokelist []*ecdsa.PublicKey }
GranteesPatch represents a structure for modifying the list of grantees.
type GranteesPatchRequest ¶ added in v2.2.0
type GranteesPatchRequest struct { // Addlist contains the list of grantees to add. Addlist []string `json:"add"` // Revokelist contains the list of grantees to revoke. Revokelist []string `json:"revoke"` }
GranteesPatchRequest represents a request to patch the list of grantees.
type GranteesPatchResponse ¶ added in v2.2.0
type GranteesPatchResponse struct { // Reference represents the swarm address. Reference swarm.Address `json:"ref"` // HistoryReference represents the reference to the history of an access control entry. HistoryReference swarm.Address `json:"historyref"` }
GranteesPatchResponse represents the response structure for patching grantees.
type GranteesPostRequest ¶ added in v2.2.0
type GranteesPostRequest struct { // GranteeList represents the list of grantees to be saves on Swarm. GranteeList []string `json:"grantees"` }
GranteesPostRequest represents the request structure for adding grantees.
type GranteesPostResponse ¶ added in v2.2.0
type GranteesPostResponse struct { // Reference represents the saved grantee list Swarm address. Reference swarm.Address `json:"ref"` // HistoryReference represents the reference to the history of an access control entry. HistoryReference swarm.Address `json:"historyref"` }
GranteesPostResponse represents the response structure for adding grantees.
type PinIntegrity ¶
type PinIntegrityResponse ¶
type PostageProof ¶
type PostageProof struct { Signature string `json:"signature"` PostageId string `json:"postageId"` Index string `json:"index"` TimeStamp string `json:"timeStamp"` }
SOCProof structure must exactly match corresponding structure (of the same name) in Redistribution.sol smart contract.
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 (*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 RCHashResponse ¶
type RCHashResponse struct { Hash swarm.Address `json:"hash"` Proofs ChunkInclusionProofs `json:"proofs"` Duration time.Duration `json:"duration"` }
type SOCProof ¶
type SOCProof struct { Signer string `json:"signer"` Signature string `json:"signature"` Identifier string `json:"identifier"` ChunkAddr string `json:"chunkAddr"` }
SOCProof structure must exactly match corresponding structure (of the same name) in Redistribution.sol smart contract.
type Service ¶
func New ¶
func New( publicKey, pssPublicKey ecdsa.PublicKey, ethereumAddress common.Address, whitelistedWithdrawalAddress []string, 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) Configure ¶
func (s *Service) Configure(signer crypto.Signer, 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) MountDebug ¶
func (s *Service) MountDebug()
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) SetRedistributionAgent ¶
func (s *Service) SetRedistributionAgent(redistributionAgent *storageincentives.Agent)
func (*Service) SetSwarmAddress ¶
type Storer ¶
type Storer interface { storer.UploadStore storer.PinStore storer.CacheStore storer.NetStore storer.LocalStore storer.RadiusChecker storer.Debugger }
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 }
UpgradedResponseWriter adds more functionality on top of ResponseWriter
Source Files ¶
- accesscontrol.go
- accounting.go
- api.go
- balances.go
- bytes.go
- bzz.go
- chequebook.go
- chunk.go
- chunk_address.go
- chunk_stream.go
- debugstorage.go
- dirs.go
- envelope.go
- feed.go
- health.go
- logger.go
- metrics.go
- node.go
- p2p.go
- peer.go
- pin.go
- pingpong.go
- postage.go
- probe.go
- pss.go
- rchash.go
- readiness.go
- redistribution.go
- router.go
- settlements.go
- soc.go
- staking.go
- status.go
- stewardship.go
- subdomain.go
- tag.go
- topology.go
- transaction.go
- util.go
- version.go
- wallet.go
- welcome_message.go