fed

package module
v0.0.0-...-50051f8 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: MIT Imports: 25 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	/*TrackByDefault forces all files to be exported by default */
	TrackByDefault = iota
	/*QuasiRealTime would sent changes as soon as they happen (actual time depends on OS); updates would be checked
	every 10 seconds or less when the underlying broker allows it. Typically used for data streaming */
	QuasiRealTime
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Attr

type Attr struct {
	IsTracked bool      `json:"isTracked"`
	PushHash  []byte    `json:"pushHash"`
	PullHash  []byte    `json:"pullHash"`
	ModTime   time.Time `json:"modTime"`
	Size      int64     `json:"size"`
}

type Connection

type Connection interface {
	Close()

	/*GetState returns the current differences between the federation and the local files */
	GetState(time time.Time) State

	/* Resolve either extract or ignore some pending changes */
	Resolve(extracts []string, ignores []string) error

	/*Mount adds a folder to be replicated to the federation */
	Mount(folder string, options ...MountOption) error

	/*SetTracked defines whether the file should be exported or not to the federation in case of changes */
	SetTracked(file string, tracked bool) error

	IsTracked(file string) bool

	GetTransport() *broker.Broker

	/*Invite creates an invite for the federation node */
	Invite(key string, exchanges []string, removeSecrets bool) (string, error)

	Sync() bool

	Rewind(t time.Time)

	Join(key string, token string) (Connection, error)

	AddExchange(id string, v interface{}) error
}

func MustOpen

func MustOpen(folder string, options ...Option) Connection

MustOpen ... is like Open but panic in case of error

func Open

func Open(folder string, metadata interface{}, options ...Option) (Connection, error)

Open ... opens a connection for the node fedId storing configuration in folder. Id must be globally unique. Connections are cached

type FileState

type FileState struct {
	Path    string    `json:"path"`
	Packet  string    `json:"packet"`
	State   string    `json:"state"`
	User    string    `json:"user"`
	Deleted bool      `json:"deleted"`
	ModTime time.Time `json:"modTime"`
}

type MountOption

type MountOption int

type NetStat

type NetStat struct {
	Name           string `json:"Name"`
	ThroughputUp   int64  `json:"throughputUp"`
	ThroughputDown int64  `json:"throughputDown"`
	ConnectErr     error  `json:"connectErr"`
}

type Option

type Option func(folder string, c *config) bool

func WithFedID

func WithFedID(id string) Option

func WithPolling

func WithPolling(enable bool) Option

func WithRetentionDays

func WithRetentionDays(days int) Option

func WithSecret

func WithSecret(secret string) Option

type State

type State struct {
	FedId         string      `json:"fedId"`
	LocalId       string      `json:"localId"`
	RetentionDays int         `json:"retentionDays"`
	FileStates    []FileState `json:"fileStates"`
}

type Update

type Update struct {
	Path       string            `json:"path"`
	Mount      string            `json:"mount"`
	IsDeletion bool              `json:"is_deletion"`
	PullHash   []byte            `json:"pullHash"`
	PushHash   []byte            `json:"pushHash"`
	ModTime    time.Time         `json:"modTime"`
	Custom     map[string]string `json:"custom"`
}

type Update2

type Update2 struct {
	State   UpdateState `json:"state"`
	ModTime time.Time   `json:"modTime"`
	Delete  bool        `json:"delete"`
	// contains filtered or unexported fields
}

type UpdateState

type UpdateState string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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