syncer

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Meta

type Meta struct {
	Metas map[string]string `json:"metas"`
}

Meta tuple.

type Peer

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

Peer tuple.

func NewPeer

func NewPeer(log *xlog.Log, metadir string, self string) *Peer

NewPeer creates a new peer.

func (*Peer) Add

func (p *Peer) Add(peer string) error

Add used to add a new peer to the peer list.

func (*Peer) Clone

func (p *Peer) Clone() []string

Clone used to copy peers info.

func (*Peer) LoadConfig

func (p *Peer) LoadConfig() error

LoadConfig used to load peers info from peersJSONFile.

func (*Peer) Remove

func (p *Peer) Remove(peer string) error

Remove used to remove a peer from the peer list.

type Syncer

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

Syncer tuple.

func NewSyncer

func NewSyncer(log *xlog.Log, metadir string, peerAddr string, router *router.Router, scatter *backend.Scatter) *Syncer

NewSyncer creates the new syncer.

func (*Syncer) AddPeer

func (s *Syncer) AddPeer(peer string) error

AddPeer used to add new peer to syncer.

func (*Syncer) Close

func (s *Syncer) Close()

Close used to close the syncer.

func (*Syncer) Init

func (s *Syncer) Init() error

Init used to load the peers from the file and start the check thread.

func (*Syncer) MetaJSON

func (s *Syncer) MetaJSON() (*Meta, error)

MetaJSON used to get the meta(in json) from the metadir.

func (*Syncer) MetaRebuild

func (s *Syncer) MetaRebuild(meta *Meta)

MetaRebuild use to re-build the metadir infos from the meta json.

func (*Syncer) MetaReload

func (s *Syncer) MetaReload() error

MetaReload used to reload the config from metadir.

func (*Syncer) MetaVersion

func (s *Syncer) MetaVersion() int64

MetaVersion returns the meta version.

func (*Syncer) MetaVersionCheck

func (s *Syncer) MetaVersionCheck() (bool, []string)

MetaVersionCheck used to check the version is synced or not.

func (*Syncer) Peers

func (s *Syncer) Peers() []string

Peers returns all the peers.

func (*Syncer) RLock

func (s *Syncer) RLock()

RLock used to acquire the lock of syncer.

func (*Syncer) RUnlock

func (s *Syncer) RUnlock()

RUnlock used to release the lock of syncer.

func (*Syncer) RemovePeer

func (s *Syncer) RemovePeer(peer string) error

RemovePeer used to remove peer from syncer.

Jump to

Keyboard shortcuts

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