Documentation
¶
Index ¶
- Constants
- Variables
- func EncodeZFSFileDiff(files []ZFSFileDiff) (string, error)
- type BackupV1
- type ByAddress
- type Clone
- type CloneWithName
- type ClonesList
- type CommitArgs
- type CommitNotification
- type DockerContainer
- type DotmeshVolume
- type DotmeshVolumeAndContainers
- type Event
- type EventArgs
- type EventType
- type FileChange
- type Filesystem
- type FilesystemContainers
- type FilesystemDeletionAudit
- type FilesystemDirty
- type FilesystemLive
- type FilesystemMaster
- type ForkRequest
- type InputFile
- type ItemData
- type KVAction
- type KVMeta
- type LastModified
- type ListFileItem
- type ListFileRequest
- type ListFileResponse
- type MountCommitRequest
- type Origin
- type OutputFile
- type PathToTopLevelFilesystem
- type PermissionDenied
- type Prelude
- type ProcureArgs
- type Query
- type RPCDiffRequest
- type RPCDiffResponse
- type RPCForkRequest
- type RegistryFilesystem
- type RollbackRequest
- type S3TransferRequest
- type SafeConfig
- type SafeUser
- type Server
- type ServerSnapshots
- type ServerState
- type Snapshot
- type StashRequest
- type SubscribeQuery
- type TopLevelFilesystem
- type TransferPollResult
- type TransferRequest
- type TransferUpdate
- type TransferUpdateKind
- type User
- type VersionInfo
- type VolumeName
- type VolumesAndBranches
- type ZFSFileDiff
Constants ¶
const ( EventNameResetRegistry = "reset-registry" EventNameResetRegistryComplete = "reset-registry-complete" )
const ( StorageBackendEtcd = "etcd" StorageBackendBoltdb = "boltdb" )
const ( EventNameSaveFailed = "save-failed" EventNameSaveSuccess = "save-success" EventNameReadFailed = "read-failed" EventNameReadSuccess = "read-success" EventNameFileNotFound = "file-not-found" EventNameDeleteFailed = "delete-failed" EventNameDeleteSuccess = "delete-success" )
const ADMIN_USER_UUID = "00000000-0000-0000-0000-000000000000"
special admin user with global privs
const ANONYMOUS_USER_UUID = "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF"
const BackupVersion string = "v1"
const BufLength = 131072
BufLength - every 128kb of data transferred through a replication, etcd is updated with the amount of data and ETA and suchlike, this is used in status reporting in `dm` for example
const (
DefaultBoltdbPath = "/data"
)
const DefaultEtcdClientPort = "42379"
const DefaultEtcdURL = "https://dotmesh-etcd:42379"
const EnvDotmeshBoltdbPath = "DOTMESH_BOLTDB_PATH"
const EnvEtcdEndpoint = "DOTMESH_ETCD_ENDPOINT"
const EnvStorageBackend = "DOTMESH_STORAGE"
const EtcdPrefix = "dotmesh.io/"
const MetaKeyPrefix = "io.dotmesh:meta-"
const NATSPublishCommitsSubject = "dotmesh.commits"
NATSPublishCommitsSubject - default NATS subject when sending commit notifications
const RootFS = "dmfs"
Variables ¶
var BackupSupportedVersions = []string{"v1"}
var EndDotmeshPrelude []byte = []byte("!!END_PRELUDE!!")
NB: It's important that the following includes characters _not_ included in the base64 alphabet. https://en.wikipedia.org/wiki/Base64
Functions ¶
func EncodeZFSFileDiff ¶
func EncodeZFSFileDiff(files []ZFSFileDiff) (string, error)
Types ¶
type BackupV1 ¶
type BackupV1 struct {
Version string `json:"version"`
Created time.Time `json:"created"`
Users []*User `json:"users"`
FilesystemMasters []*FilesystemMaster `json:"filesystem_masters"`
RegistryFilesystems []*RegistryFilesystem `json:"registry_filesystems"`
RegistryClones []*Clone `json:"registry_clones"`
}
type CloneWithName ¶
type ClonesList ¶
type ClonesList []CloneWithName
type CommitArgs ¶
type CommitNotification ¶
type CommitNotification struct {
FilesystemId string
Namespace string
Name string
Branch string
CommitId string
Metadata map[string]string
OwnerID string
CollaboratorIDs []string
}
CommitNotification - is used by dotmesh server to send notifications about new commits
type DockerContainer ¶
type DotmeshVolume ¶
type DotmeshVolumeAndContainers ¶
type DotmeshVolumeAndContainers struct {
Volume DotmeshVolume
Containers []DockerContainer
}
type Event ¶
func NewErrorEvent ¶
type EventArgs ¶
type EventArgs map[string]interface{}
EventArgs is used to pass any dynamic structs through the event system. Please not that if you send any events, they have to be registered with encoding/gob Existing registration can be found in this file at the top
type FileChange ¶
type FileChange uint
const ( FileChangeUnknown FileChange = iota FileChangeAdded FileChangeModified FileChangeRemoved FileChangeRenamed )
func (FileChange) MarshalJSON ¶
func (r FileChange) MarshalJSON() ([]byte, error)
MarshalJSON is generated so FileChange satisfies json.Marshaler.
func (FileChange) String ¶
func (c FileChange) String() string
func (*FileChange) UnmarshalJSON ¶
func (r *FileChange) UnmarshalJSON(data []byte) error
UnmarshalJSON is generated so FileChange satisfies json.Unmarshaler.
type Filesystem ¶
type FilesystemContainers ¶
type FilesystemContainers struct {
// Meta is populated by the KV store implementer
Meta *KVMeta `json:"-"`
FilesystemID string `json:"filesystem_id"`
NodeID string `json:"node_id"`
Containers []container.DockerContainer `json:"containers"`
}
type FilesystemDeletionAudit ¶
type FilesystemDeletionAudit struct {
// Meta is populated by the KV store implementer
Meta *KVMeta `json:"-"`
FilesystemID string `json:"filesystem_id"`
Server string `json:"server"`
Username string `json:"username"`
DeletedAt time.Time `json:"deleted_at"`
// These fields are mandatory
Name VolumeName `json:"name"`
TopLevelFilesystemId string `json:"top_level_filesystem_id"`
Clone string `json:"clone"`
}
type FilesystemDirty ¶
type FilesystemLive ¶
type FilesystemMaster ¶
type ForkRequest ¶
type InputFile ¶
type InputFile struct {
Filename string
// If this is nil, this will delete the file:
Contents io.Reader
User string
Response chan *Event
Extract bool
}
InputFile is used to write files to the disk on the local node, or to delete files if Contents are nil.
type KVAction ¶
type KVAction int
KVAction specifies the action on a KV pair. This is useful to make decisions from the results of a Watch.
const ( // KVSet signifies the KV was modified. KVSet KVAction = 1 << iota // KVCreate set if the KV pair was created. KVCreate // KVGet set when the key is fetched from the KV store KVGet // KVDelete set when the key is deleted from the KV store KVDelete // KVExpire set when the key expires KVExpire // KVUnknown operation on KV pair KVUnknown )
type KVMeta ¶
type KVMeta struct {
// KVDBIndex A Monotonically index updated at each modification operation.
KVDBIndex uint64
// CreatedIndex for this kv pair
CreatedIndex uint64
// ModifiedIndex for this kv pair. It's getting increased
// for all KV pairs when any modifications are made
ModifiedIndex uint64
// Action the last action on this KVPair.
Action KVAction
}
type LastModified ¶
type ListFileItem ¶
type ListFileItem struct {
Key string `json:"key"` // the full path to the item (including folders)
LastModified time.Time `json:"last_modified"`
Size int64 `json:"size"`
Directory bool `json:"directory"` // is this item a directory or a file
}
a single item in the results from s3.GetKeysForDirLimit
type ListFileRequest ¶
type ListFileRequest struct {
Base string // the root of the dot we are listing
Prefix string // the sub path we are listing
MaxKeys int64 // limit the number of files we get in the response
Page int64 // what page we are viewing - we start listing at Page * Limit
Recursive bool // do we want to recurse into folders or just look at the given path
IncludeDirectories bool // do we want directories to be included in the result or just files?
}
request when calling s3.GetKeysForDirLimit
type ListFileResponse ¶
type ListFileResponse struct {
Items []ListFileItem
TotalCount int64
}
type MountCommitRequest ¶
type OutputFile ¶
type OutputFile struct {
Filename string
SnapshotMountPath string
Contents io.Writer
User string
Response chan *Event
}
OutputFile is used to read files from the disk on the local node this is always done against a specific, already mounted snapshotId the mount path of the snapshot is passed through via SnapshotMountPath. Can also be used for stating a file, in which case Contents will be nil.
func (OutputFile) GetFilePath ¶
func (o OutputFile) GetFilePath() (string, error)
Return the path of the file on the host in a secure way.
type PathToTopLevelFilesystem ¶
type PathToTopLevelFilesystem struct {
TopLevelFilesystemId string
TopLevelFilesystemName VolumeName
Clones ClonesList
}
type PermissionDenied ¶
type PermissionDenied struct {
}
func (PermissionDenied) Error ¶
func (e PermissionDenied) Error() string
type ProcureArgs ¶
type RPCDiffRequest ¶
type RPCDiffRequest struct {
FilesystemID string
}
type RPCDiffResponse ¶
type RPCDiffResponse struct {
Files []ZFSFileDiff
}
type RPCForkRequest ¶
type RegistryFilesystem ¶
type RegistryFilesystem struct {
// Meta is populated by the KV store implementer
Meta *KVMeta `json:"-"`
Id string
OwnerId string // also know as 'namespace'
Name string // volume name
ForkParentId string `json:",omitempty"`
ForkParentSnapshotId string `json:",omitempty"`
CollaboratorIds []string
}
the type as stored in the json in etcd (intermediate representation wrt DotmeshVolume)
type RollbackRequest ¶
type S3TransferRequest ¶
type S3TransferRequest struct {
KeyID string
SecretKey string
Prefixes []string
Endpoint string
Direction string
LocalNamespace string
LocalName string
LocalBranchName string
RemoteName string
}
func (S3TransferRequest) String ¶
func (transferRequest S3TransferRequest) String() string
type SafeConfig ¶
type SafeConfig struct {
}
type ServerSnapshots ¶
type ServerState ¶
type StashRequest ¶
type SubscribeQuery ¶
func (*SubscribeQuery) GetFilesystemID ¶
func (q *SubscribeQuery) GetFilesystemID() string
func (*SubscribeQuery) GetRequestID ¶
func (q *SubscribeQuery) GetRequestID() string
type TopLevelFilesystem ¶
type TopLevelFilesystem struct {
MasterBranch DotmeshVolume
OtherBranches []DotmeshVolume
Owner SafeUser
Collaborators []SafeUser
ForkParentId string
ForkParentSnapshotId string
}
type TransferPollResult ¶
type TransferPollResult struct {
// Meta is populated by the KV store implementer
Meta *KVMeta `json:"-"`
TransferRequestId string
Peer string // hostname
User string
ApiKey string
Direction string // "push" or "pull"
// Hold onto this information, it might become useful for e.g. recursive
// receives of clone filesystems.
LocalNamespace string
LocalName string
LocalBranchName string
RemoteNamespace string
RemoteName string
RemoteBranchName string
// Same across both clusters
FilesystemId string
// TODO add clusterIds? probably comes from etcd. in fact, could be the
// discovery id (although that is only for bootstrap... hmmm).
InitiatorNodeId string
PeerNodeId string
// XXX a Transfer that spans multiple filesystem ids won't have a unique
// starting/target snapshot, so this is in the wrong place right now.
// although maybe it makes sense to talk about a target *final* snapshot,
// with interim snapshots being an implementation detail.
StartingCommit string
TargetCommit string
Index int // i.e. transfer 1/4 (Index=1)
Total int // (Total=4)
Status string // one of "starting", "running", "finished", "error"
NanosecondsElapsed int64
Size int64 // size of current segment in bytes
Sent int64 // number of bytes of current segment sent so far
Message string
}
func (TransferPollResult) String ¶
func (t TransferPollResult) String() string
type TransferRequest ¶
type TransferRequest struct {
Peer string // hostname
User string
Port int
ApiKey string //protected value in toString
Direction string // "push" or "pull"
LocalNamespace string
LocalName string
LocalBranchName string
RemoteNamespace string
RemoteName string
RemoteBranchName string
// TODO could also include SourceSnapshot here
TargetCommit string // optional, "" means "latest"
StashDivergence bool
}
func (TransferRequest) String ¶
func (transferRequest TransferRequest) String() string
type TransferUpdate ¶
type TransferUpdate struct {
Kind TransferUpdateKind
Changes TransferPollResult
GetResult chan TransferPollResult
}
type TransferUpdateKind ¶
type TransferUpdateKind int
const ( TransferStart TransferUpdateKind = iota TransferGotIds TransferCalculatedSize TransferTotalAndSize TransferProgress TransferS3Progress TransferIncrementIndex TransferStartS3Bucket TransferNextS3File TransferFinishedS3File TransferS3Stuck TransferS3Failed TransferSent TransferFinished TransferStatus TransferGetCurrentPollResult )
type User ¶
type User struct {
Id string
Name string
Email string
Salt []byte
Password []byte
ApiKey string
Metadata map[string]string
}
type VersionInfo ¶
type VersionInfo struct {
InstalledVersion string `json:"installed_version"`
CurrentVersion string `json:"current_version"`
CurrentReleaseDate int `json:"current_release_date"`
CurrentDownloadURL string `json:"current_download_url"`
CurrentChangelogURL string `json:"current_changelog_url"`
ProjectWebsite string `json:"project_website"`
Outdated bool `json:"outdated"`
}
type VolumeName ¶
func (VolumeName) String ¶
func (v VolumeName) String() string
func (VolumeName) StringWithoutAdmin ¶
func (v VolumeName) StringWithoutAdmin() string
type VolumesAndBranches ¶
type VolumesAndBranches struct {
Dots []TopLevelFilesystem
Servers []Server
}
type ZFSFileDiff ¶
type ZFSFileDiff struct {
Change FileChange `json:"change"`
Filename string `json:"filename"`
}
func DecodeZFSFileDiff ¶
func DecodeZFSFileDiff(data string) ([]ZFSFileDiff, error)