Documentation
¶
Overview ¶
Package replicat is a server for n way synchronization of content (rsync for the cloud). More information at: http://replic.at Copyright 2016 Jacob Taylor jacob@ablox.io License: Apache2 - http://www.apache.org/licenses/LICENSE-2.0
Package replicat is a server for n way synchronization of content (rsync for the cloud). More information at: http://replic.at Copyright 2016 Jacob Taylor jacob@ablox.io License: Apache2 - http://www.apache.org/licenses/LICENSE-2.0
Package replicat is a server for n way synchronization of content (rsync for the cloud). More information at: http://replic.at Copyright 2016 Jacob Taylor jacob@ablox.io License: Apache2 - http://www.apache.org/licenses/LICENSE-2.0
Package replicat is a server for n way synchronization of content (rsync for the cloud). More information at: http://replic.at Copyright 2016 Jacob Taylor jacob@ablox.io License: Apache2 - http://www.apache.org/licenses/LICENSE-2.0
Package replicat is a server for n way synchronization of content (rsync for the cloud). More information at: http://replic.at Copyright 2016 Jacob Taylor jacob@ablox.io License: Apache2 - http://www.apache.org/licenses/LICENSE-2.0
Package replicat is a server for n way synchronization of content (rsync for the cloud). More information at: http://replic.at Copyright 2016 Jacob Taylor jacob@ablox.io License: Apache2 - http://www.apache.org/licenses/LICENSE-2.0
Index ¶
- Constants
- func BootstrapAndServe(address string)
- func SendEvent(event Event, fullPath string)
- func SetGlobalSettings(newSettings Settings)
- func WaitFor(tracker *FilesystemTracker, folder string, waitingFor bool, ...) bool
- type ChangeHandler
- type DirTreeMap
- type Entry
- type Event
- type FilesystemTracker
- func (handler *FilesystemTracker) CreatePath(pathName string, isDirectory bool) (err error)
- func (handler *FilesystemTracker) DeleteFolder(name string) error
- func (handler *FilesystemTracker) ListFolders() (folderList []string)
- func (handler *FilesystemTracker) Rename(sourcePath string, destinationPath string, isDirectory bool) (err error)
- type LogOnlyChangeHandler
- func (handler *LogOnlyChangeHandler) FileCreated(name string) error
- func (handler *LogOnlyChangeHandler) FileDeleted(name string) error
- func (handler *LogOnlyChangeHandler) FileUpdated(name string) error
- func (handler *LogOnlyChangeHandler) FolderCreated(name string) error
- func (handler *LogOnlyChangeHandler) FolderDeleted(name string) error
- func (handler *LogOnlyChangeHandler) FolderUpdated(name string) error
- type Node
- type ReplicatServer
- type Settings
- type StorageTracker
Constants ¶
const ( // OWNERSHIP_EXPIRATION_TIMEOUT - Duration for a replicated change to hold ownership after they make changes. This leaves time for multiple filesystem events to come back without being reported to other nodes OWNERSHIP_EXPIRATION_TIMEOUT = 5 * time.Second )
const ( // TRACKER_RENAME_TIMEOUT - the amount of time to sleep while waiting for the second event in a rename process TRACKER_RENAME_TIMEOUT = time.Millisecond * 25 )
Variables ¶
This section is empty.
Functions ¶
func BootstrapAndServe ¶
func BootstrapAndServe(address string)
BootstrapAndServe - Start the server
func SendEvent ¶
SendEvent gets events that have happened off to the peer servers so they can replicate the same change
func SetGlobalSettings ¶
func SetGlobalSettings(newSettings Settings)
SetGlobalSettings -- set the settings for the replicat server
func WaitFor ¶
func WaitFor(tracker *FilesystemTracker, folder string, waitingFor bool, helper func(tracker *FilesystemTracker, folder string) bool) bool
WaitFor - a helper function that will politely wait until the helper argument function evaluates to the value of waitingFor. this is great for waiting for the tracker to catch up to the filesystem in tests, for example.
Types ¶
type ChangeHandler ¶
type ChangeHandler interface {
FolderCreated(name string) (err error)
FolderDeleted(name string) (err error)
FolderUpdated(name string) (err error)
FileCreated(name string) (err error)
FileDeleted(name string) (err error)
FileUpdated(name string) (err error)
}
ChangeHandler - Listener for tracking changes that happen to a storage system
type DirTreeMap ¶
DirTreeMap is a mapping between directories and lists of file names.
type Entry ¶
Entry - contains the data for a file
func NewDirectoryFromFileInfo ¶
NewDirectoryFromFileInfo - creates and returns a new Directory based on a fileinfo structure
type Event ¶
type Event struct {
Source string
Name string
Path string
SourcePath string
Time time.Time
IsDirectory bool
NetworkSource string
}
Event stores the relevant information on events or updates to the storage layer.
type FilesystemTracker ¶
type FilesystemTracker struct {
// contains filtered or unexported fields
}
FilesystemTracker - Track a filesystem and keep it in sync
func (*FilesystemTracker) CreatePath ¶
func (handler *FilesystemTracker) CreatePath(pathName string, isDirectory bool) (err error)
CreatePath tells the storage tracker to create a new path
func (*FilesystemTracker) DeleteFolder ¶
func (handler *FilesystemTracker) DeleteFolder(name string) error
DeleteFolder - This storage handler should remove the specified path
func (*FilesystemTracker) ListFolders ¶
func (handler *FilesystemTracker) ListFolders() (folderList []string)
ListFolders - This storage handler should return a list of contained folders.
type LogOnlyChangeHandler ¶
type LogOnlyChangeHandler struct {
}
LogOnlyChangeHandler - sample change handler
func (*LogOnlyChangeHandler) FileCreated ¶
func (handler *LogOnlyChangeHandler) FileCreated(name string) error
FileCreated - track a new folder being created
func (*LogOnlyChangeHandler) FileDeleted ¶
func (handler *LogOnlyChangeHandler) FileDeleted(name string) error
FileDeleted - track a new folder being deleted
func (*LogOnlyChangeHandler) FileUpdated ¶
func (handler *LogOnlyChangeHandler) FileUpdated(name string) error
FileUpdated - track a folder being updated
func (*LogOnlyChangeHandler) FolderCreated ¶
func (handler *LogOnlyChangeHandler) FolderCreated(name string) error
FolderCreated - track a new folder being created
func (*LogOnlyChangeHandler) FolderDeleted ¶
func (handler *LogOnlyChangeHandler) FolderDeleted(name string) error
FolderDeleted - track a new folder being deleted
func (*LogOnlyChangeHandler) FolderUpdated ¶
func (handler *LogOnlyChangeHandler) FolderUpdated(name string) error
FolderUpdated - track a folder being updated
type ReplicatServer ¶
type ReplicatServer struct {
ClusterKey string
Name string
Address string
CurrentState DirTreeMap
PreviousState DirTreeMap
Lock sync.Mutex
// contains filtered or unexported fields
}
ReplicatServer is a structure that contains the definition of the servers in a cluster. Each node has a name and this node (as determined by globalSettings.name at the moment) also has a StorageTracker interface.
type Settings ¶
type Settings struct {
Name string
ManagerAddress string
ManagerCredentials string
ClusterKey string
Nodes map[string]Node
}
Settings - for the server. including a map of the nodes
func GetGlobalSettings ¶
func GetGlobalSettings() Settings
GetGlobalSettings -- retrieve the settings for the replicat server
type StorageTracker ¶
type StorageTracker interface {
CreatePath(relativePath string, isDirectory bool) (err error)
Rename(sourcePath string, destinationPath string, isDirectory bool) (err error)
DeleteFolder(name string) (err error)
ListFolders() (folderList []string)
}
StorageTracker - Listener that allows you to tell the tracker what has happened elsewhere so it can mirror the changes