common

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package common provides utilities to set network options.

Index

Constants

This section is empty.

Variables

View Source
var HostKey crypto.PrivKey

Functions

This section is empty.

Types

type LogstoreType

type LogstoreType string
const (
	LogstoreInMemory   LogstoreType = "in-memory"
	LogstorePersistent LogstoreType = "persistent"
	LogstoreHybrid     LogstoreType = "hybrid"
)

type NetBoostrapper

type NetBoostrapper interface {
	app.Net
	GetIpfsLite() *ipfslite.Peer
	Bootstrap(addrs []peer.AddrInfo)
}

func DefaultNetwork

func DefaultNetwork(opts ...NetOption) (NetBoostrapper, error)

DefaultNetwork is a boostrapable default Net with sane defaults.

type NetConfig

type NetConfig struct {
	NetPullingLimit           uint
	NetPullingStartAfter      time.Duration
	NetPullingInitialInterval time.Duration
	NetPullingInterval        time.Duration
	NoNetPulling              bool
	NoExchangeEdgesMigration  bool
	PubSub                    bool
	LSType                    LogstoreType
	BadgerRepoPath            string
	MongoUri                  string
	MongoDB                   string
	HostAddr                  ma.Multiaddr
	ConnManager               cconnmgr.ConnManager
	GRPCServerOptions         []grpc.ServerOption
	GRPCDialOptions           []grpc.DialOption
	Debug                     bool
}

type NetOption

type NetOption func(c *NetConfig) error

func WithConnectionManager

func WithConnectionManager(cm cconnmgr.ConnManager) NetOption

func WithNetBadgerPersistence

func WithNetBadgerPersistence(repoPath string) NetOption

func WithNetDebug

func WithNetDebug(enabled bool) NetOption

func WithNetGRPCDialOptions

func WithNetGRPCDialOptions(opts ...grpc.DialOption) NetOption

func WithNetGRPCServerOptions

func WithNetGRPCServerOptions(opts ...grpc.ServerOption) NetOption

func WithNetHostAddr

func WithNetHostAddr(addr ma.Multiaddr) NetOption

func WithNetLogstore

func WithNetLogstore(lt LogstoreType) NetOption

func WithNetMongoPersistence

func WithNetMongoPersistence(uri, db string) NetOption

func WithNetPubSub

func WithNetPubSub(enabled bool) NetOption

func WithNetPulling

func WithNetPulling(threadLimit uint, startAfter, initialInterval, interval time.Duration) NetOption

func WithNoExchangeEdgesMigration

func WithNoExchangeEdgesMigration(disable bool) NetOption

func WithNoNetPulling

func WithNoNetPulling(disable bool) NetOption

Jump to

Keyboard shortcuts

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