C# Class SmartSync.DeploymentRepository

ファイルを表示 Open project: projectkudu/KuduCalf

Public Methods

Method Description
CreateSnapshotFromDirectory ( DirectoryInfo dirRoot, string comment, bool>.Func filter = null ) : SnapshotId
CreateSnapshotFromFiles ( FileInfo>.IEnumerable fileList, string comment ) : SnapshotId
FromToken ( string tok ) : SnapshotId
GetAddedItemsBetweenSnapshots ( SnapshotId currentId, SnapshotId targetId ) : IEnumerable
GetDeletedItemsBetweenSnapshots ( SnapshotId currentId, SnapshotId targetId ) : IEnumerable
GetLatestSnapshot ( ) : SnapshotInfo
GetLatestSnapshotId ( ) : SnapshotId
GetPreviousSnapshot ( SnapshotInfo snapshotInfo ) : SnapshotInfo
GetPreviousSnapshotId ( SnapshotId snapshotId ) : SnapshotId
GetSnapshotInfo ( SnapshotId snapshotId ) : SnapshotInfo
GetSnapshotItems ( SnapshotId token ) : IEnumerable
Initialize ( ) : bool
ListAllSnapshots ( ) : IEnumerable
ListSnapshotsBetween ( SnapshotId firstId, SnapshotId lastId ) : IEnumerable

List snapshots between first id and last id inclusive.

PopulateDirectoryFromSnapshot ( SnapshotId snapshotId, DirectoryInfo dirRoot ) : void

Copies files from snapshot to dirRoot.

Doesn't delete any data, only adds or modifies data under dirRoot.

ProcessDeletionsBetweenSnapshot ( SnapshotId currentId, SnapshotId targetId, DirectoryInfo dirRoot ) : void
UpdateDirectoryFromSnapshot ( SnapshotId currentId, SnapshotId targetId, DirectoryInfo dirRoot ) : void

Protected Methods

Method Description
DeploymentRepository ( ) : System
SafeCombinePath ( DirectoryInfo dirInfo, string path ) : string

This does a path concatenation but verifies that the resulting file path is a results in a path underneath the root. This is a security best practice to avoid folks modifying files by creating relative paths such as "foo\..\..\bar"

TryCopyFile ( string src, string dst, bool logCopyFiles = true ) : bool
TryDeleteFile ( string path ) : bool

Private Methods

Method Description
ListFilesInDirectory ( DirectoryInfo dirRoot, DirectoryInfo curDir, bool>.Func filter ) : FileInfo>>.IEnumerable

Method Details

CreateSnapshotFromDirectory() public method

public CreateSnapshotFromDirectory ( DirectoryInfo dirRoot, string comment, bool>.Func filter = null ) : SnapshotId
dirRoot System.IO.DirectoryInfo
comment string
filter bool>.Func
return SnapshotId

CreateSnapshotFromFiles() public abstract method

public abstract CreateSnapshotFromFiles ( FileInfo>.IEnumerable fileList, string comment ) : SnapshotId
fileList FileInfo>.IEnumerable
comment string
return SnapshotId

DeploymentRepository() protected method

protected DeploymentRepository ( ) : System
return System

FromToken() public abstract method

public abstract FromToken ( string tok ) : SnapshotId
tok string
return SnapshotId

GetAddedItemsBetweenSnapshots() public method

public GetAddedItemsBetweenSnapshots ( SnapshotId currentId, SnapshotId targetId ) : IEnumerable
currentId SnapshotId
targetId SnapshotId
return IEnumerable

GetDeletedItemsBetweenSnapshots() public method

public GetDeletedItemsBetweenSnapshots ( SnapshotId currentId, SnapshotId targetId ) : IEnumerable
currentId SnapshotId
targetId SnapshotId
return IEnumerable

GetLatestSnapshot() public method

public GetLatestSnapshot ( ) : SnapshotInfo
return SnapshotInfo

GetLatestSnapshotId() public abstract method

public abstract GetLatestSnapshotId ( ) : SnapshotId
return SnapshotId

GetPreviousSnapshot() public method

public GetPreviousSnapshot ( SnapshotInfo snapshotInfo ) : SnapshotInfo
snapshotInfo SnapshotInfo
return SnapshotInfo

GetPreviousSnapshotId() public abstract method

public abstract GetPreviousSnapshotId ( SnapshotId snapshotId ) : SnapshotId
snapshotId SnapshotId
return SnapshotId

GetSnapshotInfo() public abstract method

public abstract GetSnapshotInfo ( SnapshotId snapshotId ) : SnapshotInfo
snapshotId SnapshotId
return SnapshotInfo

GetSnapshotItems() public abstract method

public abstract GetSnapshotItems ( SnapshotId token ) : IEnumerable
token SnapshotId
return IEnumerable

Initialize() public abstract method

public abstract Initialize ( ) : bool
return bool

ListAllSnapshots() public method

public ListAllSnapshots ( ) : IEnumerable
return IEnumerable

ListSnapshotsBetween() public method

List snapshots between first id and last id inclusive.
public ListSnapshotsBetween ( SnapshotId firstId, SnapshotId lastId ) : IEnumerable
firstId SnapshotId A more recently created snapshot.
lastId SnapshotId An id older than first Id
return IEnumerable

PopulateDirectoryFromSnapshot() public method

Copies files from snapshot to dirRoot.
Doesn't delete any data, only adds or modifies data under dirRoot.
public PopulateDirectoryFromSnapshot ( SnapshotId snapshotId, DirectoryInfo dirRoot ) : void
snapshotId SnapshotId The snapshot id
dirRoot System.IO.DirectoryInfo Root to extract
return void

ProcessDeletionsBetweenSnapshot() public method

public ProcessDeletionsBetweenSnapshot ( SnapshotId currentId, SnapshotId targetId, DirectoryInfo dirRoot ) : void
currentId SnapshotId
targetId SnapshotId
dirRoot System.IO.DirectoryInfo
return void

SafeCombinePath() protected method

This does a path concatenation but verifies that the resulting file path is a results in a path underneath the root. This is a security best practice to avoid folks modifying files by creating relative paths such as "foo\..\..\bar"
protected SafeCombinePath ( DirectoryInfo dirInfo, string path ) : string
dirInfo System.IO.DirectoryInfo
path string
return string

TryCopyFile() protected method

protected TryCopyFile ( string src, string dst, bool logCopyFiles = true ) : bool
src string
dst string
logCopyFiles bool
return bool

TryDeleteFile() protected method

protected TryDeleteFile ( string path ) : bool
path string
return bool

UpdateDirectoryFromSnapshot() public method

public UpdateDirectoryFromSnapshot ( SnapshotId currentId, SnapshotId targetId, DirectoryInfo dirRoot ) : void
currentId SnapshotId
targetId SnapshotId
dirRoot System.IO.DirectoryInfo
return void