コード例 #1
0
        public long RegisterRemoteVolume(string name, RemoteVolumeType type, RemoteVolumeState state, TimeSpan deleteGraceTime, System.Data.IDbTransaction transaction)
        {
            using (var tr = new TemporaryTransactionWrapper(m_connection, transaction))
            {
                m_createremotevolumeCommand.SetParameterValue(0, m_operationid);
                m_createremotevolumeCommand.SetParameterValue(1, name);
                m_createremotevolumeCommand.SetParameterValue(2, type.ToString());
                m_createremotevolumeCommand.SetParameterValue(3, state.ToString());
                m_createremotevolumeCommand.SetParameterValue(4, 0);

                if (deleteGraceTime.Ticks <= 0)
                {
                    m_createremotevolumeCommand.SetParameterValue(5, 0);
                }
                else
                {
                    m_createremotevolumeCommand.SetParameterValue(5, (DateTime.UtcNow + deleteGraceTime).Ticks);
                }

                m_createremotevolumeCommand.Transaction = tr.Parent;
                var r = m_createremotevolumeCommand.ExecuteScalarInt64();
                tr.Commit();
                return(r);
            }
        }
コード例 #2
0
ファイル: RemoteVolumeEntry.cs プロジェクト: admz/duplicati
 public RemoteVolumeEntry(string name, string hash, long size, RemoteVolumeType type, RemoteVolumeState state)
 {
     m_name = name;
     m_size = size;
     m_type = type;
     m_state = state;
     m_hash = hash;
 }
コード例 #3
0
ファイル: BackendManager.cs プロジェクト: rocifier/duplicati
 public void LogDbUpdate(string remotename, RemoteVolumeState state, long size, string hash)
 {
     lock (m_dbqueuelock)
         m_dbqueue.Add(new DbUpdate()
         {
             Remotename = remotename, State = state, Size = size, Hash = hash
         });
 }
コード例 #4
0
ファイル: RemoteVolumeEntry.cs プロジェクト: tamsky/duplicati
 public RemoteVolumeEntry(string name, string hash, long size, RemoteVolumeType type, RemoteVolumeState state)
 {
     m_name  = name;
     m_size  = size;
     m_type  = type;
     m_state = state;
     m_hash  = hash;
 }
コード例 #5
0
 public RemoteVolumeEntry(string name, string hash, long size, RemoteVolumeType type, RemoteVolumeState state, DateTime deleteGracePeriod)
 {
     m_name = name;
     m_size = size;
     m_type = type;
     m_state = state;
     m_hash = hash;
     m_deleteGracePeriod = deleteGracePeriod;
 }
コード例 #6
0
 public RemoteVolumeEntry(string name, string hash, long size, RemoteVolumeType type, RemoteVolumeState state, DateTime deleteGracePeriod)
 {
     m_name              = name;
     m_size              = size;
     m_type              = type;
     m_state             = state;
     m_hash              = hash;
     m_deleteGracePeriod = deleteGracePeriod;
 }
コード例 #7
0
 public RemoteVolumeEntry(long id, string name, string hash, long size, RemoteVolumeType type, RemoteVolumeState state, DateTime deleteGracePeriod)
 {
     ID                = id;
     Name              = name;
     Size              = size;
     Type              = type;
     State             = state;
     Hash              = hash;
     DeleteGracePeriod = deleteGracePeriod;
 }
コード例 #8
0
 public long RegisterRemoteVolume(string name, RemoteVolumeType type, RemoteVolumeState state, System.Data.IDbTransaction transaction = null)
 {
     using (var tr = new TemporaryTransactionWrapper(m_connection, transaction))
     {
         m_createremotevolumeCommand.SetParameterValue(0, m_operationid);
         m_createremotevolumeCommand.SetParameterValue(1, name);
         m_createremotevolumeCommand.SetParameterValue(2, type.ToString());
         m_createremotevolumeCommand.SetParameterValue(3, state.ToString());
         m_createremotevolumeCommand.SetParameterValue(4, 0);
         m_createremotevolumeCommand.Transaction = tr.Parent;
         var r = Convert.ToInt64(m_createremotevolumeCommand.ExecuteScalar());
         tr.Commit();
         return(r);
     }
 }
コード例 #9
0
        public void UpdateRemoteVolume(string name, RemoteVolumeState state, long size, string hash, System.Data.IDbTransaction transaction = null)
        {
            m_updateremotevolumeCommand.Transaction = transaction;
            m_updateremotevolumeCommand.SetParameterValue(0, m_operationid);
            m_updateremotevolumeCommand.SetParameterValue(1, state.ToString());
            m_updateremotevolumeCommand.SetParameterValue(2, hash);
            m_updateremotevolumeCommand.SetParameterValue(3, size);
            m_updateremotevolumeCommand.SetParameterValue(4, name);
            var c = m_updateremotevolumeCommand.ExecuteNonQuery();

            if (c != 1)
            {
                throw new Exception("Unexpected number of remote volumes detected!");
            }

            if (state == RemoteVolumeState.Deleted)
            {
                RemoveRemoteVolume(name, transaction);
            }
        }
コード例 #10
0
        public bool GetRemoteVolume(string file, out string hash, out long size, out RemoteVolumeType type, out RemoteVolumeState state)
        {
            m_selectremotevolumeCommand.SetParameterValue(0, file);
            using (var rd = m_selectremotevolumeCommand.ExecuteReader())
                if (rd.Read())
                {
                    hash  = (rd.GetValue(2) == null || rd.GetValue(2) == DBNull.Value) ? null : rd.GetValue(3).ToString();
                    size  = (rd.GetValue(1) == null || rd.GetValue(1) == DBNull.Value) ? -1 : Convert.ToInt64(rd.GetValue(2));
                    type  = (RemoteVolumeType)Enum.Parse(typeof(RemoteVolumeType), rd.GetValue(0).ToString());
                    state = (RemoteVolumeState)Enum.Parse(typeof(RemoteVolumeState), rd.GetValue(3).ToString());
                    return(true);
                }

            hash  = null;
            size  = -1;
            type  = (RemoteVolumeType)(-1);
            state = (RemoteVolumeState)(-1);
            return(false);
        }
コード例 #11
0
 public Task UpdateRemoteVolumeAsync(string name, RemoteVolumeState state, long size, string hash, bool suppressCleanup = false, TimeSpan deleteGraceTime = default(TimeSpan))
 {
     return(RunOnMain(() => m_db.UpdateRemoteVolume(name, state, size, hash, suppressCleanup, deleteGraceTime, m_transaction)));
 }
コード例 #12
0
 public Task <long> RegisterRemoteVolumeAsync(string name, RemoteVolumeType type, RemoteVolumeState state)
 {
     return(RunOnMain(() => m_db.RegisterRemoteVolume(name, type, state, m_transaction)));
 }
コード例 #13
0
ファイル: BackendManager.cs プロジェクト: Berimor66/duplicati
 public void LogDbUpdate(string remotename, RemoteVolumeState state, long size, string hash)
 {
     lock(m_dbqueuelock)
         m_dbqueue.Add(new DbUpdate() { Remotename = remotename, State = state, Size = size, Hash = hash });
 }
コード例 #14
0
 public long RegisterRemoteVolume(string name, RemoteVolumeType type, RemoteVolumeState state, System.Data.IDbTransaction transaction)
 {
     return(RegisterRemoteVolume(name, type, state, new TimeSpan(0), transaction));
 }
コード例 #15
0
 public long RegisterRemoteVolume(string name, RemoteVolumeType type, RemoteVolumeState state)
 {
     return(RegisterRemoteVolume(name, type, state, new TimeSpan(0), null));
 }