C# Class Smithers.Worker.Jobs.PrePurchasing.AzureStorageService

Mostra file Open project: ucdavis/Smithers

Public Methods

Method Description
AzureStorageService ( string serverName, string sqlUsername, string sqlPassword, string storageAccountName, string storageKey, string storageContainer, string storageUrl = null, int cleanupThreshold = -4 ) : System

Backup ( string database, List tables, string &filename ) : string

Execute the srcDatabase backup

BackupDataSync ( string database, string &filename ) : string

Backup a srcDatabase that has datasync enabled

BlobCleanup ( ) : IEnumerable

Cleans up the container, deleting old backupss

Code based on example: https://www.windowsazure.com/en-us/develop/net/how-to-guides/blob-storage/

GetStatus ( string requestId ) : string

Get status of srcDatabase backup job

Private Methods

Method Description
CleanupTmp ( string tmpDatabase, string masterDbConnectionString ) : void

Remove the temporary srcDatabase

CreateCopy ( string srcDatabase, string tmpDatabase, string masterDbConnectionString ) : void

makes a copy of the srcDatabase

DisableTriggers ( string tmpDbConnectionString ) : void

Disables ALL database triggers period.

Disabling these allows the srcDatabase to be restored without errors. Once restored, ALL database triggers can be re-enabled without incident by issuing the command from an AZURE query window: ENABLE TRIGGER ALL ON DATABASE

RemoveDataSync ( string tmpDbConnectionString ) : void

Removes all the necessary tables/sprocs/triggers that are related to DataSync

Removing these allows the srcDatabase to be restored and minimizes a little of the spaced needed for backups. The triggers are the only necessary part, as they prevent restoration from blob storage.

Method Details

AzureStorageService() public method

public AzureStorageService ( string serverName, string sqlUsername, string sqlPassword, string storageAccountName, string storageKey, string storageContainer, string storageUrl = null, int cleanupThreshold = -4 ) : System
serverName string
sqlUsername string
sqlPassword string
storageAccountName string
storageKey string
storageContainer string
storageUrl string Overrides using the standard domain of blob.core.windows.net, based on storage account name
cleanupThreshold int # of days to before clearing out old backups
return System

Backup() public method

Execute the srcDatabase backup
public Backup ( string database, List tables, string &filename ) : string
database string Name of srcDatabase to backup
tables List List of tables for selective backup, null if backup entire srcDatabase
filename string Generated filename for blob storage
return string

BackupDataSync() public method

Backup a srcDatabase that has datasync enabled
public BackupDataSync ( string database, string &filename ) : string
database string
filename string
return string

BlobCleanup() public method

Cleans up the container, deleting old backupss
Code based on example: https://www.windowsazure.com/en-us/develop/net/how-to-guides/blob-storage/
public BlobCleanup ( ) : IEnumerable
return IEnumerable

GetStatus() public method

Get status of srcDatabase backup job
public GetStatus ( string requestId ) : string
requestId string
return string