Exemplo n.º 1
0
 /// <summary>
 /// Store an object within a container in the deduplication index if it doesn't already exist, or, replace the object if it does.
 /// This method will use the callbacks supplied in the method signature.
 /// </summary>
 /// <param name="objectName">The name of the object.  Must be unique in the index.</param>
 /// <param name="callbacks">CallbackMethods object containing callback methods.</param>
 /// <param name="data">The byte data for the object.</param>
 /// <param name="chunks">The list of chunks identified during the deduplication operation.</param>
 /// <returns>True if successful.</returns>
 public bool StoreOrReplaceObject(string objectName, CallbackMethods callbacks, byte[] data, out List <Chunk> chunks)
 {
     if (data == null || data.Length < 1)
     {
         throw new ArgumentNullException(nameof(data));
     }
     return(StoreOrReplaceObject(objectName, callbacks, data.Length, DedupeCommon.BytesToStream(data), out chunks));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Store an object in the deduplication index.
 /// </summary>
 /// <param name="objectName">The name of the object.  Must be unique in the index.</param>
 /// <param name="data">The byte data for the object.</param>
 /// <param name="chunks">The list of chunks identified during the deduplication operation.</param>
 /// <returns>True if successful.</returns>
 public bool StoreObject(string objectName, byte[] data, out List <Chunk> chunks)
 {
     //if (data == null || data.Length < 1) throw new ArgumentNullException(nameof(data));
     if (data == null || data.Length < 1)
     {
         chunks = new List <Chunk>();
         return(false);
     }
     return(StoreObject(objectName, Callbacks, data.Length, DedupeCommon.BytesToStream(data), out chunks));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Write an object to the deduplication index if it doesn't already exist, or, replace the object if it does.
 /// This method will use the callbacks supplied in the method signature.
 /// </summary>
 /// <param name="key">The object key.  Must be unique in the index.</param>
 /// <param name="callbacks">CallbackMethods object containing callback methods.</param>
 /// <param name="data">The byte data for the object.</param>
 public void WriteOrReplace(string key, DedupeCallbacks callbacks, byte[] data)
 {
     if (String.IsNullOrEmpty(key))
     {
         throw new ArgumentNullException(nameof(key));
     }
     if (data == null || data.Length < 1)
     {
         throw new ArgumentNullException(nameof(data));
     }
     WriteOrReplace(key, callbacks, data.Length, DedupeCommon.BytesToStream(data));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Write an object to the deduplication index.
 /// This method will use the callbacks supplied in the method signature.
 /// </summary>
 /// <param name="key">The object key.  Must be unique in the index.</param>
 /// <param name="callbacks">CallbackMethods object containing callback methods.</param>
 /// <param name="bytes">The byte data for the object.</param>
 public void Write(string key, DedupeCallbacks callbacks, byte[] bytes)
 {
     if (String.IsNullOrEmpty(key))
     {
         throw new ArgumentNullException(nameof(key));
     }
     if (bytes == null || bytes.Length < 1)
     {
         throw new ArgumentNullException(nameof(bytes));
     }
     Write(key, callbacks, bytes.Length, DedupeCommon.BytesToStream(bytes));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Write an object to the deduplication index.
 /// This method will use the callbacks supplied in the method signature.
 /// </summary>
 /// <param name="key">The object key.  Must be unique in the index.</param>
 /// <param name="callbacks">CallbackMethods object containing callback methods.</param>
 /// <param name="data">The string data for the object.</param>
 public void Write(string key, DedupeCallbacks callbacks, string data)
 {
     if (String.IsNullOrEmpty(key))
     {
         throw new ArgumentNullException(nameof(key));
     }
     if (String.IsNullOrEmpty(data))
     {
         throw new ArgumentNullException(nameof(data));
     }
     byte[] bytes = Encoding.UTF8.GetBytes(data);
     Write(key, callbacks, bytes.Length, DedupeCommon.BytesToStream(bytes));
 }