Documentation ¶
Overview ¶
Package core contains the core dependencies
Index ¶
- Variables
- func BytesToSlice(bytes [32]byte) []byte
- func CopyBigInt(val *big.Int) *big.Int
- func ExpandOrReturnPath(path string) string
- func GetEnv(name, defaultVal string) string
- func GetEnvInt(name string, defaultVal int) int
- func HasEnv(name string) bool
- func IsTest() bool
- func PtrTo[T any](v T) *T
- func RandomItem[T any](items []T) (res T, _ error)
- func SleepWithContext(ctx context.Context, dur time.Duration) error
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var LogLevels = []zapcore.Level{zapcore.DebugLevel, zapcore.InfoLevel, zapcore.WarnLevel, zapcore.ErrorLevel, zapcore.DPanicLevel, zapcore.PanicLevel, zapcore.FatalLevel}
LogLevels stores available log levels in serverity order.
Functions ¶
func BytesToSlice ¶
BytesToSlice converts a 32 bit array to a slice slice.
func CopyBigInt ¶
CopyBigInt creates a copy of a big int without mutating the original.
func ExpandOrReturnPath ¶ added in v0.0.6
ExpandOrReturnPath expands a homedir path, if it can't be expanded, the original dir is returned since on these systems homedir cannot be used anyway.
func GetEnv ¶
GetEnv gets an environment variable. If it is not present, the default variable is used.
func GetEnvInt ¶
GetEnvInt gets an environment variable as an int. if not found or cast the defaultVal is returned.
func IsTest ¶ added in v0.0.11
func IsTest() bool
IsTest returns true if the current process is a test.
func PtrTo ¶ added in v0.0.32
func PtrTo[T any](v T) *T
PtrTo returns a pointer to the given value.
Example ¶
package main import ( "fmt" "github.com/ethereum/go-ethereum/common" "github.com/synapsecns/sanguine/core" "reflect" ) func main() { res := core.PtrTo(common.Hash{}) fmt.Println(reflect.TypeOf(res)) }
Output: *common.Hash
func RandomItem ¶ added in v0.0.36
RandomItem is a generic function to get a random item from a slice.
func SleepWithContext ¶ added in v0.0.43
SleepWithContext will wait for the timer duration to expire, or the context is canceled. Which ever happens first. If the context is canceled the Context's error will be returned.
Expects Context to always return a non-nil error if the Done channel is closed. Note: this was taknen from the aws sdk, but modified to avoid the dependency in core.
Types ¶
This section is empty.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package bytemap is an implementation of https://github.com/google/triemap/blob/main/bytemap.go with generic support for values
|
Package bytemap is an implementation of https://github.com/google/triemap/blob/main/bytemap.go with generic support for values |
Package commandline contains common utilities for use across clis
|
Package commandline contains common utilities for use across clis |
Package config contains the configuration required to run a node.
|
Package config contains the configuration required to run a node. |
Package dbcommon provides common database functionality
|
Package dbcommon provides common database functionality |
Package dockerutil contains facilities for programs to add context to docker tests.
|
Package dockerutil contains facilities for programs to add context to docker tests. |
Package ginhelper provides some common functionality across gin servers.
|
Package ginhelper provides some common functionality across gin servers. |
internal
|
|
assets
Package assets provides static assets we want to embed in the application in the main folder and documentation related assets in subfolders.
|
Package assets provides static assets we want to embed in the application in the main folder and documentation related assets in subfolders. |
Package mapmutex provides an extensible, type-safe mutex implementation TODO: use generics
|
Package mapmutex provides an extensible, type-safe mutex implementation TODO: use generics |
Package merkle provides the tools to create a merkle tree and keep track of its historical states.
|
Package merkle provides the tools to create a merkle tree and keep track of its historical states. |
Package metrics implements a metrics dashboard with either datadog or prometheus (coming soon)
|
Package metrics implements a metrics dashboard with either datadog or prometheus (coming soon) |
internal
Package internal contains internal constants for metrics package this is done in a separate package to avoid circular dependencies
|
Package internal contains internal constants for metrics package this is done in a separate package to avoid circular dependencies |
localmetrics
Package localmetrics provides a local server for metrics.
|
Package localmetrics provides a local server for metrics. |
newrelic
Package newrelic provides custom wrpapers for newrelic.
|
Package newrelic provides custom wrpapers for newrelic. |
pyroscope
Package pyroscope implements pyroscope.io client.
|
Package pyroscope implements pyroscope.io client. |
Package mocktesting is used for mocking out the testing.T interface.
|
Package mocktesting is used for mocking out the testing.T interface. |
Package observer provides an observer implementation
|
Package observer provides an observer implementation |
Package processlog contains an opinionated method for piping logs from external processes into stdout and readbale files for testing..
|
Package processlog contains an opinionated method for piping logs from external processes into stdout and readbale files for testing.. |
Package prom exposes metrics on synapse-node
|
Package prom exposes metrics on synapse-node |
Package retry provides a simple yet powerful retry mechanism for Go.
|
Package retry provides a simple yet powerful retry mechanism for Go. |
Package server provides a way to access a server TODO: consider moving this into gin helper
|
Package server provides a way to access a server TODO: consider moving this into gin helper |
Package testsuite contains the standard test suite
|
Package testsuite contains the standard test suite |
Package threaditer extends iter with a mutex for thread safe use
|
Package threaditer extends iter with a mutex for thread safe use |
Package toml contains common utilities for implementing toml types.
|
Package toml contains common utilities for implementing toml types. |
Package tunnel provides a simple interface to start a tunnel to a backend URL.
|
Package tunnel provides a simple interface to start a tunnel to a backend URL. |
internal
Package internal provides the internal tunnel implementation.
|
Package internal provides the internal tunnel implementation. |
moe
Package moe provides a tunnel that uses the Moe protocol.
|
Package moe provides a tunnel that uses the Moe protocol. |
ngrok
Package ngrok provides a tunnel that uses ngrok to expose a local port to the internet.
|
Package ngrok provides a tunnel that uses ngrok to expose a local port to the internet. |
types
Package types provides common types to avoid circular dependencies.
|
Package types provides common types to avoid circular dependencies. |