model

package
v0.2.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2016 License: MPL-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionInfo

type ConnectionInfo struct {
	DeviceID string
	Address  string
}

type Model

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

func NewModel

func NewModel(cfg *config.Wrapper, db *bolt.DB) *Model

func (*Model) AddConnection

func (m *Model) AddConnection(conn connections.Connection, hello protocol.HelloResult)

func (*Model) Closed

func (m *Model) Closed(conn protocol.Connection, err error)

The peer device closed the connection

func (*Model) ClusterConfig

func (m *Model) ClusterConfig(deviceID protocol.DeviceID, config protocol.ClusterConfig)

A cluster configuration message was received

func (*Model) ConnectedTo

func (m *Model) ConnectedTo(deviceID protocol.DeviceID) bool

func (*Model) DownloadProgress

func (m *Model) DownloadProgress(device protocol.DeviceID, folder string, updates []protocol.FileDownloadProgressUpdate)

func (*Model) GetChildren

func (m *Model) GetChildren(folder string, path string) []protocol.FileInfo

func (*Model) GetConnections

func (m *Model) GetConnections() []ConnectionInfo

func (*Model) GetEntry

func (m *Model) GetEntry(folder string, path string) (protocol.FileInfo, bool)

func (*Model) GetFileData

func (m *Model) GetFileData(folder string, filepath string, readStart int64, readSize int) ([]byte, error)

func (*Model) GetFolders

func (m *Model) GetFolders() []string

func (*Model) GetHello

func (m *Model) GetHello(protocol.DeviceID) protocol.HelloIntf

GetHello is called when we are about to connect to some remote device.

func (*Model) GetPathsMatchingPrefix

func (m *Model) GetPathsMatchingPrefix(folderID string, pathPrefix string) []string

func (*Model) GetPinsStatusByFolder

func (m *Model) GetPinsStatusByFolder() map[string]string

func (*Model) HasFolder

func (m *Model) HasFolder(folder string) bool

func (*Model) Index

func (m *Model) Index(deviceID protocol.DeviceID, folder string, files []protocol.FileInfo)

An index was received from the peer device

func (*Model) IndexUpdate

func (m *Model) IndexUpdate(deviceID protocol.DeviceID, folder string, files []protocol.FileInfo)

An index update was received from the peer device

func (*Model) IsPaused

func (m *Model) IsPaused(deviceID protocol.DeviceID) bool

func (*Model) OnHello

func (m *Model) OnHello(remoteID protocol.DeviceID, addr net.Addr, hello protocol.HelloResult) error

OnHello is called when an device connects to us. This allows us to extract some information from the Hello message and add it to a list of known devices ahead of any checks.

func (*Model) Request

func (m *Model) Request(deviceID protocol.DeviceID, folder string, name string, offset int64, hash []byte, fromTemporary bool, buf []byte) error

A request was made by the peer device

Jump to

Keyboard shortcuts

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