server

package
v0.44.2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: Apache-2.0 Imports: 41 Imported by: 4

Documentation

Index

Constants

View Source
const (
	LivenessPath    = "/live"
	MetricsPath     = "/metrics"
	EmulatorApiPath = "/emulator/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockResponse added in v0.27.0

type BlockResponse struct {
	Height  int    `json:"height"`
	BlockId string `json:"blockId"`
	Context string `json:"context,omitempty"`
}

type BlocksTicker

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

func NewBlocksTicker

func NewBlocksTicker(
	backend *backend.Backend,
	blockTime time.Duration,
) *BlocksTicker

func (*BlocksTicker) Start

func (t *BlocksTicker) Start() error

func (*BlocksTicker) Stop

func (t *BlocksTicker) Stop()

type Config

type Config struct {
	GRPCPort                  int
	GRPCDebug                 bool
	AdminPort                 int
	DebuggerPort              int
	RESTPort                  int
	RESTDebug                 bool
	HTTPHeaders               []HTTPHeader
	BlockTime                 time.Duration
	ServicePublicKey          crypto.PublicKey
	ServicePrivateKey         crypto.PrivateKey
	ServiceKeySigAlgo         crypto.SignatureAlgorithm
	ServiceKeyHashAlgo        crypto.HashAlgorithm
	GenesisTokenSupply        cadence.UFix64
	TransactionExpiry         uint
	StorageLimitEnabled       bool
	MinimumStorageReservation cadence.UFix64
	StorageMBPerFLOW          cadence.UFix64
	TransactionFeesEnabled    bool
	TransactionMaxGasLimit    uint64
	ScriptGasLimit            uint64
	Persist                   bool
	Snapshot                  bool
	// ContractRemovalEnabled configures possible removal of contracts.
	ContractRemovalEnabled bool
	// DBPath is the path to the Badger database on disk.
	DBPath string
	// DBGCInterval is the time interval at which to garbage collect the Badger value log.
	DBGCInterval time.Duration
	// DBGCDiscardRatio is the ratio of space to reclaim during a Badger garbage collection run.
	DBGCDiscardRatio float64
	// LivenessCheckTolerance is the time interval in which the server must respond to liveness probes.
	LivenessCheckTolerance time.Duration
	// Whether to deploy some extra Flow contracts when emulator starts
	WithContracts bool
	// Enable simple monotonically increasing address format (e.g. 0x1, 0x2, etc)
	SimpleAddressesEnabled    bool
	SkipTransactionValidation bool
	// Host listen on for the emulator servers (REST/GRPC/Admin)
	Host string
	//Chain to emulation
	ChainID flowgo.ChainID
	//Redis URL for redis storage backend
	RedisURL string
	//Sqlite URL for sqlite storage backend
	SqliteURL string
}

Config is the configuration for an emulator server.

type DeployDescription added in v0.27.0

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

type EmulatorAPIServer added in v0.34.0

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

func NewEmulatorAPIServer added in v0.34.0

func NewEmulatorAPIServer(server *EmulatorServer, backend *backend.Backend, storage *Storage) *EmulatorAPIServer

func (EmulatorAPIServer) CommitBlock added in v0.34.0

func (m EmulatorAPIServer) CommitBlock(w http.ResponseWriter, r *http.Request)

func (EmulatorAPIServer) Config added in v0.44.0

func (EmulatorAPIServer) ServeHTTP added in v0.34.0

func (m EmulatorAPIServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (EmulatorAPIServer) SnapshotCreate added in v0.43.0

func (m EmulatorAPIServer) SnapshotCreate(w http.ResponseWriter, r *http.Request)

func (EmulatorAPIServer) SnapshotJump added in v0.43.0

func (m EmulatorAPIServer) SnapshotJump(w http.ResponseWriter, r *http.Request)

func (EmulatorAPIServer) SnapshotList added in v0.43.0

func (m EmulatorAPIServer) SnapshotList(w http.ResponseWriter, _ *http.Request)

func (EmulatorAPIServer) Storage added in v0.34.0

type EmulatorServer

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

EmulatorServer is a local server that runs a Flow Emulator instance.

The server wraps an emulated blockchain instance with the Access API gRPC handlers.

func NewEmulatorServer

func NewEmulatorServer(logger *zerolog.Logger, conf *Config) *EmulatorServer

NewEmulatorServer creates a new instance of a Flow Emulator server.

func (*EmulatorServer) Listen added in v0.40.0

func (s *EmulatorServer) Listen() error

Listen starts listening for incoming connections.

After this non-blocking function executes we can treat the emulator server as ready.

func (*EmulatorServer) Start

func (s *EmulatorServer) Start()

Start starts the Flow Emulator server.

This is a blocking call that listens and starts the emulator server.

func (*EmulatorServer) Stop

func (s *EmulatorServer) Stop()

type GRPCServer

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

func NewGRPCServer

func NewGRPCServer(logger *zerolog.Logger, b *backend.Backend, chain flow.Chain, host string, port int, debug bool) *GRPCServer

func (*GRPCServer) Listen added in v0.40.0

func (g *GRPCServer) Listen() error

func (*GRPCServer) Server

func (g *GRPCServer) Server() *grpc.Server

func (*GRPCServer) Start

func (g *GRPCServer) Start() error

func (*GRPCServer) Stop

func (g *GRPCServer) Stop()

type HTTPHeader

type HTTPHeader struct {
	Key   string
	Value string
}

type HTTPServer

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

func NewAdminServer added in v0.28.0

func NewAdminServer(
	logger *zerolog.Logger,
	emulatorServer *EmulatorServer,
	backend *backend.Backend,
	storage *Storage,
	grpcServer *GRPCServer,
	liveness *LivenessTicker,
	host string,
	port int,
	headers []HTTPHeader,
) *HTTPServer

func (*HTTPServer) Listen added in v0.40.0

func (h *HTTPServer) Listen() error

func (*HTTPServer) Start

func (h *HTTPServer) Start() error

func (*HTTPServer) Stop

func (h *HTTPServer) Stop()

type LivenessTicker

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

func NewLivenessTicker

func NewLivenessTicker(tolerance time.Duration) *LivenessTicker

func (*LivenessTicker) Handler

func (l *LivenessTicker) Handler() http.Handler

func (*LivenessTicker) Start

func (l *LivenessTicker) Start() error

func (*LivenessTicker) Stop

func (l *LivenessTicker) Stop()

type MemoryStorage

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

func NewMemoryStorage

func NewMemoryStorage() *MemoryStorage

func (*MemoryStorage) Start

func (s *MemoryStorage) Start() error

func (*MemoryStorage) Stop

func (s *MemoryStorage) Stop()

func (*MemoryStorage) Store

func (s *MemoryStorage) Store() storage.Store

type RedisStorage added in v0.40.0

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

func NewRedisStorage added in v0.40.0

func NewRedisStorage(url string) (*RedisStorage, error)

func (*RedisStorage) Start added in v0.40.0

func (s *RedisStorage) Start() error

func (*RedisStorage) Stop added in v0.40.0

func (s *RedisStorage) Stop()

func (*RedisStorage) Store added in v0.40.0

func (s *RedisStorage) Store() storage.Store

type RestServer added in v0.28.0

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

func NewRestServer added in v0.28.0

func NewRestServer(logger *zerolog.Logger, be *backend.Backend, chain flow.Chain, host string, port int, debug bool) (*RestServer, error)

func (*RestServer) Listen added in v0.40.0

func (r *RestServer) Listen() error

func (*RestServer) Start added in v0.28.0

func (r *RestServer) Start() error

func (*RestServer) Stop added in v0.28.0

func (r *RestServer) Stop()

type SqliteStorage added in v0.44.0

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

func NewSqliteStorage added in v0.44.0

func NewSqliteStorage(url string) (*SqliteStorage, error)

func (*SqliteStorage) Start added in v0.44.0

func (s *SqliteStorage) Start() error

func (*SqliteStorage) Stop added in v0.44.0

func (s *SqliteStorage) Stop()

func (*SqliteStorage) Store added in v0.44.0

func (s *SqliteStorage) Store() storage.Store

type Storage

type Storage interface {
	graceland.Routine
	Store() storage.Store
}

Directories

Path Synopsis
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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