azure-storage-blob2 2.0.8 → 2.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,171 @@
1
+ # frozen_string_literal: true
2
+
3
+ #-------------------------------------------------------------------------
4
+ # # Copyright (c) Microsoft and contributors. All rights reserved.
5
+ #
6
+ # The MIT License(MIT)
7
+
8
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ # of this software and associated documentation files(the "Software"), to deal
10
+ # in the Software without restriction, including without limitation the rights
11
+ # to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
12
+ # copies of the Software, and to permit persons to whom the Software is
13
+ # furnished to do so, subject to the following conditions :
14
+
15
+ # The above copyright notice and this permission notice shall be included in
16
+ # all copies or substantial portions of the Software.
17
+
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
21
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ # THE SOFTWARE.
25
+ #--------------------------------------------------------------------------
26
+
27
+ require "rbconfig"
28
+
29
+ module Azure::Storage::Blob
30
+ module Default
31
+ # Default REST service (STG) version number
32
+ STG_VERSION = "2018-11-09"
33
+
34
+ # The number of default concurrent requests for parallel operation.
35
+ DEFAULT_PARALLEL_OPERATION_THREAD_COUNT = 1
36
+
37
+ # Constant representing a kilobyte (Non-SI version).
38
+ KB = 1024
39
+ # Constant representing a megabyte (Non-SI version).
40
+ MB = 1024 * 1024
41
+ # Constant representing a gigabyte (Non-SI version).
42
+ GB = 1024 * 1024 * 1024
43
+
44
+ # Specifies HTTP.
45
+ HTTP = "http"
46
+ # Specifies HTTPS.
47
+ HTTPS = "https"
48
+ # Default HTTP port.
49
+ DEFAULT_HTTP_PORT = 80
50
+ # Default HTTPS port.
51
+ DEFAULT_HTTPS_PORT = 443
52
+
53
+ # Marker for atom metadata.
54
+ XML_METADATA_MARKER = "$"
55
+ # Marker for atom value.
56
+ XML_VALUE_MARKER = "_"
57
+
58
+ # Default value for Content-Type if request has body.
59
+ CONTENT_TYPE_VALUE = "application/octet-stream"
60
+
61
+ # Default User Agent header string
62
+ USER_AGENT = "Azure-Storage/#{Azure::Storage::Blob::Version.to_uas}-#{Azure::Storage::Common::Version.to_uas} (Ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}; #{Azure::Storage::Common::Default.os})".freeze
63
+ end
64
+
65
+ # Defines constants for use with blob operations.
66
+ module BlobConstants
67
+ # XML element for the latest.
68
+ LATEST_ELEMENT = "Latest"
69
+
70
+ # XML element for uncommitted blocks.
71
+ UNCOMMITTED_ELEMENT = "Uncommitted"
72
+
73
+ # XML element for a block list.
74
+ BLOCK_LIST_ELEMENT = "BlockList"
75
+
76
+ # XML element for committed blocks.
77
+ COMMITTED_ELEMENT = "Committed"
78
+
79
+ # The default write page size, in bytes, used by blob streams.
80
+ DEFAULT_WRITE_PAGE_SIZE_IN_BYTES = 4 * 1024 * 1024
81
+
82
+ # The minimum write page size, in bytes, used by blob streams.
83
+ MIN_WRITE_PAGE_SIZE_IN_BYTES = 2 * 1024 * 1024
84
+
85
+ # The default maximum size, in bytes, of a blob before it must be separated into blocks.
86
+ DEFAULT_SINGLE_BLOB_PUT_THRESHOLD_IN_BYTES = 128 * 1024 * 1024
87
+
88
+ # The default write block size, in bytes, used by blob streams.
89
+ DEFAULT_WRITE_BLOCK_SIZE_IN_BYTES = 4 * 1024 * 1024
90
+
91
+ # The maximum size of a single block.
92
+ MAX_BLOCK_SIZE = 100 * 1024 * 1024
93
+
94
+ # The maximum count of blocks for a block blob
95
+ MAX_BLOCK_COUNT = 50000
96
+
97
+ # The maximum size of block blob
98
+ MAX_BLOCK_BLOB_SIZE = 50000 * 100 * 1024 * 1024
99
+
100
+ # The maximum size of block blob
101
+ MAX_APPEND_BLOB_SIZE = 1024 * 1024 * 1024 * 1024
102
+
103
+ # The maximum size, in bytes, of a blob before it must be separated into blocks.
104
+ MAX_SINGLE_UPLOAD_BLOB_SIZE_IN_BYTES = 256 * 1024 * 1024
105
+
106
+ # The maximum range get size when requesting for a contentMD5
107
+ MAX_RANGE_GET_SIZE_WITH_MD5 = 4 * 1024 * 1024
108
+
109
+ # The maximum page range size for a page update operation.
110
+ MAX_UPDATE_PAGE_SIZE = 4 * 1024 * 1024
111
+
112
+ # The maximum buffer size for writing a stream buffer.
113
+ MAX_QUEUED_WRITE_DISK_BUFFER_SIZE = 64 * 1024 * 1024
114
+
115
+ # Max size for single get page range. The max value should be 150MB
116
+ # http://blogs.msdn.com/b/windowsazurestorage/archive/2012/03/26/getting-the-page-ranges-of-a-large-page-blob-in-segments.aspx
117
+ MAX_SINGLE_GET_PAGE_RANGE_SIZE = 37 * 4 * 1024 * 1024
118
+
119
+ # The size of a page, in bytes, in a page blob.
120
+ PAGE_SIZE = 512
121
+
122
+ # The maximum validity of user delegation SAS (7 days from the current time).
123
+ MAX_USER_DELEGATION_KEY_SECONDS = 60 * 60 * 24 * 7
124
+
125
+ # Resource types.
126
+ module ResourceTypes
127
+ CONTAINER = "c"
128
+ BLOB = "b"
129
+ end
130
+
131
+ # List blob types.
132
+ module ListBlobTypes
133
+ Blob = "b"
134
+ Directory = "d"
135
+ end
136
+
137
+ # Put page write options
138
+ module PageWriteOptions
139
+ UPDATE = "update"
140
+ CLEAR = "clear"
141
+ end
142
+
143
+ # Blob types
144
+ module BlobTypes
145
+ BLOCK = "BlockBlob"
146
+ PAGE = "PageBlob"
147
+ APPEND = "AppendBlob"
148
+ end
149
+
150
+ # Blob lease constants
151
+ module LeaseOperation
152
+ ACQUIRE = "acquire"
153
+ RENEW = "renew"
154
+ CHANGE = "change"
155
+ RELEASE = "release"
156
+ BREAK = "break"
157
+ end
158
+ end
159
+
160
+ module BlobErrorCodeStrings
161
+ INVALID_BLOCK_ID = "InvalidBlockId"
162
+ BLOB_NOT_FOUND = "BlobNotFound"
163
+ BLOB_ALREADY_EXISTS = "BlobAlreadyExists"
164
+ CONTAINER_ALREADY_EXISTS = "ContainerAlreadyExists"
165
+ CONTAINER_NOT_FOUND = "ContainerNotFound"
166
+ INVALID_BLOB_OR_BLOCK = "InvalidBlobOrBlock"
167
+ INVALID_BLOCK_LIST = "InvalidBlockList"
168
+ MAX_BLOB_SIZE_CONDITION_NOT_MET = "MaxBlobSizeConditionNotMet"
169
+ APPEND_POSITION_CONDITION_NOT_MET = "AppendPositionConditionNotMet"
170
+ end
171
+ end