beelite

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: Apache-2.0 Imports: 97 Imported by: 0

README

bee-lite

Go Reference

bee-lite is an embeddable, lightweight bee node for applications to use swarm directly

How to run

lo := &beelite.LiteOptions {
    FullNodeMode:             false,
    BootnodeMode:             false,
    Bootnodes:                []string{"/dnsaddr/mainnet.ethswarm.org"},
    StaticNodes:              []string{<STATIC_NODE_ADDRESSES>},
    DataDir:                  dataDir,
    WelcomeMessage:           "Welcome from bee-lite",
    BlockchainRpcEndpoint:    <RPC_ENDPOINT>,
    SwapInitialDeposit:       "10000000000000000",
    PaymentThreshold:         "100000000",
    SwapEnable:               true,
    ChequebookEnable:         true,
    DebugAPIEnable:           false,
    UsePostageSnapshot:       false,
    Mainnet:                  true,
    NetworkID:                1,
    NATAddr:                  "<NAT_ADDRESS>:<PORT>",
    CacheCapacity:            32 * 1024 * 1024,
    DBOpenFilesLimit:         50,
    DBWriteBufferSize:        32 * 1024 * 1024,
    DBBlockCacheCapacity:     32 * 1024 * 1024,
    DBDisableSeeksCompaction: false,
    RetrievalCaching:         true,
}

const loglevel = "4"
bl, err := beelite.Start(lo, password, loglevel)
if err != nil {
    return err
}

Documentation

Index

Constants

View Source
const (
	ContentTypeHeader   = "Content-Type"
	ContentLengthHeader = "Content-Length"
)
View Source
const (
	LoggerName = "beelite"
)
View Source
const (
	ReserveCapacity = 4_194_304 // 2^22 chunks

)
View Source
const (
	TopicLength = 32
)

Variables

View Source
var ErrShutdownInProgress error = errors.New("shutdown in progress")

Functions

This section is empty.

Types

type Bee

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

func (*Bee) Shutdown

func (b *Bee) Shutdown() error

func (*Bee) SyncingStopped

func (b *Bee) SyncingStopped() chan struct{}

type Beelite

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

func NewBee

func NewBee(
	ctx context.Context,
	addr string,
	publicKey *ecdsa.PublicKey,
	signer crypto.Signer,
	networkID uint64,
	logger log.Logger,
	libp2pPrivateKey,
	pssPrivateKey *ecdsa.PrivateKey,
	o *node.Options,
) (bl *Beelite, err error)

func Start

func Start(lo *LiteOptions, password string, verbosity string) (bl *Beelite, errMain error)

func (*Beelite) AddBytes

func (bl *Beelite) AddBytes(parentContext context.Context, batchHex string, encrypt bool, rLevel redundancy.Level, reader io.Reader) (reference swarm.Address, err error)

func (*Beelite) AddChunk

func (bl *Beelite) AddChunk(parentContext context.Context, batchHex string, reader io.Reader, swarmTag uint64) (reference swarm.Address, err error)

func (*Beelite) AddDirBzz

func (bl *Beelite) AddDirBzz(
	parentContext context.Context,
	batchHex,
	filename,
	contentType,
	indexFilename,
	errorFilename string,
	encrypt bool,
	rLevel redundancy.Level,
	reader io.Reader,
) (reference swarm.Address, err error)

func (*Beelite) AddFeed

func (bl *Beelite) AddFeed(ctx context.Context, batchHex, owner, topic string, encrypt bool, rLevel redundancy.Level) (reference swarm.Address, err error)

func (*Beelite) AddFileBzz

func (bl *Beelite) AddFileBzz(parentContext context.Context,
	batchHex,
	filename,
	contentType string,
	encrypt bool,
	rLevel redundancy.Level,
	reader io.Reader,
) (reference swarm.Address, err error)

func (*Beelite) AddSOC

func (bl *Beelite) AddSOC(ctx context.Context,
	batchHex string,
	reader io.Reader,
	id []byte,
	owner []byte,
	sig []byte,
) (reference swarm.Address, err error)

func (*Beelite) BeeNodeMode

func (bl *Beelite) BeeNodeMode() api.BeeNodeMode

func (*Beelite) BuyStamp

func (bl *Beelite) BuyStamp(amount *big.Int, depth uint64, label string, immutable bool) (common.Hash, []byte, error)

func (*Beelite) ChequebookAddr

func (bl *Beelite) ChequebookAddr() common.Address

func (*Beelite) ChequebookBalance

func (bl *Beelite) ChequebookBalance() (*big.Int, error)

func (*Beelite) ChequebookWithdraw

func (bl *Beelite) ChequebookWithdraw(amount *big.Int) (common.Hash, error)

func (*Beelite) ConnectedPeerCount

func (bl *Beelite) ConnectedPeerCount() int

func (*Beelite) GetAllBatches

func (bl *Beelite) GetAllBatches() []*postage.StampIssuer

func (*Beelite) GetBytes

func (bl *Beelite) GetBytes(parentContext context.Context, reference swarm.Address) (io.Reader, error)

func (*Beelite) GetBzz

func (bl *Beelite) GetBzz(parentContext context.Context, address swarm.Address) (io.Reader, string, error)

func (*Beelite) GetChunk

func (bl *Beelite) GetChunk(parentContext context.Context, reference swarm.Address) (swarm.Chunk, error)

func (*Beelite) GetUsableBatches

func (bl *Beelite) GetUsableBatches() []*postage.StampIssuer

func (*Beelite) OverlayEthAddress

func (bl *Beelite) OverlayEthAddress() common.Address

type FileInfo

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

type LiteOptions

type LiteOptions struct {
	FullNodeMode             bool
	BootnodeMode             bool
	Bootnodes                []string
	StaticNodes              []string
	DataDir                  string
	WelcomeMessage           string
	BlockchainRpcEndpoint    string
	SwapInitialDeposit       string
	PaymentThreshold         string
	SwapEnable               bool
	ChequebookEnable         bool
	UsePostageSnapshot       bool
	DebugAPIEnable           bool
	Mainnet                  bool
	NetworkID                uint64
	NATAddr                  string
	CacheCapacity            uint64
	DBOpenFilesLimit         uint64
	DBWriteBufferSize        uint64
	DBBlockCacheCapacity     uint64
	DBDisableSeeksCompaction bool
	RetrievalCaching         bool
}

type Topic

type Topic [TopicLength]byte

Jump to

Keyboard shortcuts

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