sync

package
v1.13.7 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Databases = map[Database]string{
	DBLocalSafe: "local_safe.db",
	DBCrossSafe: "cross_safe.db",
}

Databases maps a database alias to its actual name on disk

Functions

This section is empty.

Types

type Client

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

Client handles downloading files from a sync server.

func NewClient

func NewClient(config Config, serverURL string) (*Client, error)

NewClient creates a new Client with the given config and server URL.

func (*Client) SyncAll

func (c *Client) SyncAll(ctx context.Context, chains []eth.ChainID, resume bool) error

SyncAll syncs all known databases for the given chains.

func (*Client) SyncDatabase

func (c *Client) SyncDatabase(ctx context.Context, chainID eth.ChainID, database Database, resume bool) error

SyncDatabase downloads the named file from the server. If the local file exists, it will attempt to resume the download if resume is true.

type Config

type Config struct {
	DataDir string
	Logger  log.Logger
}

Config contains all configuration for the Server or Client.

type Database

type Database string
const (
	DBLocalSafe Database = "local_safe"
	DBCrossSafe Database = "cross_safe"
)

func (Database) File

func (d Database) File() string

func (Database) String

func (d Database) String() string

type Server

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

Server handles sync requests

func NewServer

func NewServer(config Config, chains []eth.ChainID) (*Server, error)

NewServer creates a new Server with the given config.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler.

Jump to

Keyboard shortcuts

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