internal static CustomMetadata FromSWIG(SWIG.UplinkObject obj)
        {
            CustomMetadata ret = new CustomMetadata();

            ret.Entries = new List <CustomMetadataEntry>();

            if (mut.WaitOne(1000))
            {
                try
                {
                    SWIG.storj_uplink.prepare_get_custommetadata(obj);

                    for (int i = 0; i < obj.custom.count; i++)
                    {
                        using (var entry = SWIG.storj_uplink.get_next_custommetadata())
                        {
                            ret.Entries.Add(new CustomMetadataEntry {
                                Key = entry.key, Value = entry.value
                            });
                        }
                    }
                }
                finally
                {
                    mut.ReleaseMutex();
                }
            }

            return(ret);
        }
        internal UploadOperation(Stream stream, SWIG.UplinkUploadResult uploadResult, string objectName, CustomMetadata customMetadata = null)
        {
            _byteStreamToUpload = stream;
            _upload             = uploadResult.upload;
            ObjectName          = objectName;
            _customMetadata     = customMetadata;

            if (uploadResult.error != null && !string.IsNullOrEmpty(uploadResult.error.message))
            {
                _errorMessage = uploadResult.error.message;
                Failed        = true;
                Running       = false;
            }
        }
Exemple #3
0
        internal static Object FromSWIG(SWIG.Object original, bool disposeObjectInfo = true)
        {
            Object ret = new Object();

            ret.Key            = original.key;
            ret.IsPrefix       = original.is_prefix;
            ret.SystemMetaData = SystemMetadata.FromSWIG(original.system);
            ret.CustomMetaData = CustomMetadata.FromSWIG(original);

            if (disposeObjectInfo)
            {
                SWIG.storj_uplink.free_object(original);
            }

            return(ret);
        }
 internal ChunkedUploadOperation(SWIG.UploadResult uploadResult, string objectName, CustomMetadata customMetadata = null)
 {
     _uploadResult   = uploadResult;
     _objectName     = objectName;
     _customMetadata = customMetadata;
 }
 internal UploadOperation(byte[] bytesToUpload, SWIG.UplinkUploadResult uploadResult, string objectName, CustomMetadata customMetadata = null) :
     this(new MemoryStream(bytesToUpload), uploadResult, objectName, customMetadata)
 {
 }