Documentation
¶
Overview ¶
Package remotesapi implements a simple API for accessing all remotes and their online state as well as triggering syncs and diffs. Normally this involves at least three different APIs.
Index ¶
- type Folder
- type Identity
- type Mock
- func (m *Mock) Get(name string) (*Remote, error)
- func (m *Mock) List() ([]*Remote, error)
- func (m *Mock) MakeDiff(name string) (*catfs.Diff, error)
- func (m *Mock) OnChange(fn func())
- func (m *Mock) Remove(name string) error
- func (m *Mock) Self() (Identity, error)
- func (m *Mock) Set(rm Remote) error
- func (m *Mock) Sync(name string) error
- type Remote
- type RemotesAPI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Folder ¶
type Folder struct { Folder string `json:"folder"` ReadOnly bool `json:"read_only"` ConflictStrategy string `json:"conflict_strategy"` }
Folder is a single folder limit for a remote.
type Mock ¶
type Mock struct {
// contains filtered or unexported fields
}
Mock is for testing purposes whenever a normal RemotesAPI is needed. It stores remotes in memory and does not implement really syncing or diffing.
func (*Mock) OnChange ¶
func (m *Mock) OnChange(fn func())
OnChange register a callback to be called once the remote list changes.
type Remote ¶
type Remote struct { Name string `json:"name"` Folders []Folder `json:"folders"` Fingerprint string `json:"fingerprint"` AcceptAutoUpdates bool `json:"accept_auto_updates"` IsOnline bool `json:"is_online"` IsAuthenticated bool `json:"is_authenticated"` AcceptPush bool `json:"accept_push"` ConflictStrategy string `json:"conflict_strategy"` LastSeen time.Time `json:"last_seen"` }
Remote is a the result of List and Get.
type RemotesAPI ¶
type RemotesAPI interface { List() ([]*Remote, error) Get(name string) (*Remote, error) Set(rm Remote) error Remove(name string) error Self() (Identity, error) OnChange(fn func()) Sync(name string) error MakeDiff(name string) (*catfs.Diff, error) }
RemotesAPI provides a simpler interface to accessing remote information from repo.Repository, net.PeerServer and events.EventListener.
Click to show internal directories.
Click to hide internal directories.