Documentation ¶
Overview ¶
Package state is where all the logic happens. There is a global state that is updated when events are received, and in response it gives command to execute to the platforms. Those commands can be to change the local filesystem, to change the remote Cozy, or for controls (exit for example).
Index ¶
- func Sync(platform Platform) error
- type CmdChanges
- type CmdCreateDir
- type CmdMkdir
- type CmdRefreshToken
- type CmdScan
- type CmdStat
- type CmdStop
- type CmdSynchronized
- type Command
- type Event
- type EventChangesDone
- type EventCreateDirDone
- type EventMkdirDone
- type EventScanDone
- type EventStart
- type EventStatDone
- type EventSynchronized
- type EventTokenRefreshed
- type Platform
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CmdChanges ¶
CmdChanges is a command to fetch the changes feed of the Cozy.
func (CmdChanges) Exec ¶
func (cmd CmdChanges) Exec(platform Platform)
Exec is required by Command interface.
type CmdCreateDir ¶
CmdCreateDir is a command for creating a directory on the Cozy.
func (CmdCreateDir) Exec ¶
func (cmd CmdCreateDir) Exec(platform Platform)
Exec is required by Command interface.
type CmdRefreshToken ¶
CmdRefreshToken is a command to refresh the access token of the OAuth client.
func (CmdRefreshToken) Exec ¶
func (cmd CmdRefreshToken) Exec(platform Platform)
Exec is required by Command interface.
type CmdScan ¶
type CmdScan struct {
Path string
}
CmdScan is a command to list files and directories inside a directory.
type CmdStat ¶
type CmdStat struct {
Path string
}
CmdStat is a command for making a stat call on a file. It allows to know if it is a file or a directory, the size, the inode number, etc.
type CmdSynchronized ¶
CmdSynchronized is a command to let the Cozy know that the client has reach a stable point of synchronization.
func (CmdSynchronized) Exec ¶
func (cmd CmdSynchronized) Exec(platform Platform)
Exec is required by Command interface.
type Command ¶
type Command interface {
Exec(platform Platform)
}
Command is used to ask the local filesystem or the remote Cozy to execute things.
type Event ¶
Event is a way to give information to update the state when a change happens on the local filesystem or the remote Cozy.
type EventChangesDone ¶
type EventChangesDone struct { Cmd CmdChanges Docs []*remote.ChangedDoc Seq *remote.Seq Pending int Error error }
EventChangesDone is used to notify of the result of the changes feed.
func (EventChangesDone) Update ¶
func (e EventChangesDone) Update(state *State) []Command
Update is required by Event interface.
type EventCreateDirDone ¶
type EventCreateDirDone struct { Cmd CmdCreateDir Doc *remote.Doc Error error }
EventCreateDirDone is notified when a directory has been by the desktop client on the Cozy.
func (EventCreateDirDone) Update ¶
func (e EventCreateDirDone) Update(state *State) []Command
Update is required by Event interface.
type EventMkdirDone ¶
EventMkdirDone is notified when a directory has been by the desktop client on the local file system.
func (EventMkdirDone) Update ¶
func (e EventMkdirDone) Update(state *State) []Command
Update is required by Event interface.
type EventScanDone ¶
EventScanDone is notified after the scan has been done to send back the result, a list of DirEntry.
func (EventScanDone) Update ¶
func (e EventScanDone) Update(state *State) []Command
Update is required by Event interface.
type EventStart ¶
type EventStart struct{}
EventStart is used to starts the client.
func (EventStart) Update ¶
func (e EventStart) Update(state *State) []Command
Update is required by Event interface.
type EventStatDone ¶
EventStatDone is an event notified after a stat call was made to send back the result.
func (EventStatDone) Update ¶
func (e EventStatDone) Update(state *State) []Command
Update is required by Event interface.
type EventSynchronized ¶
type EventSynchronized struct { Cmd CmdSynchronized Error error }
EventSynchronized is notified when the Cozy has been informed of the synchronization, or the call has failed.
func (EventSynchronized) Update ¶
func (e EventSynchronized) Update(state *State) []Command
Update is required by Event interface.
type EventTokenRefreshed ¶
type EventTokenRefreshed struct { Cmd CmdRefreshToken Error error }
EventTokenRefreshed is notified when the access token has been refreshed, or when the attempt has failed.
func (EventTokenRefreshed) Update ¶
func (e EventTokenRefreshed) Update(state *State) []Command
Update is required by Event interface.