Module: Uplink
- Defined in:
- lib/uplink.rb,
lib/uplink/access.rb,
lib/uplink/bucket.rb,
lib/uplink/object.rb,
lib/uplink/upload.rb,
lib/uplink/project.rb,
lib/uplink/download.rb,
lib/uplink/error_util.rb,
lib/uplink/storj_error.rb,
lib/uplink/uplink_util.rb,
lib/uplink/edge_credential.rb
Defined Under Namespace
Classes: Access, BandwidthLimitExceededError, Bucket, BucketAlreadyExistsError, BucketIterator, BucketNameInvalidError, BucketNotEmptyError, BucketNotFoundError, CanceledError, Download, EdgeAuthDialFailedError, EdgeCredential, EdgeRegisterAccessFailedError, ErrorUtil, InternalError, InvalidHandleError, Object, ObjectIterator, ObjectKeyInvalidError, ObjectKeyNotFoundError, PartUpload, Project, SegmentsLimitExceededError, StorageLimitExceededError, StorjError, TooManyRequestError, UplinkUtil, Upload, UploadDoneError, UploadInfo, UploadIterator, UploadPart, UploadPartIterator
Constant Summary
collapse
- EOF =
-1
- UPLINK_ERROR_INTERNAL =
0x02
- UPLINK_ERROR_CANCELED =
0x03
- UPLINK_ERROR_INVALID_HANDLE =
0x04
- UPLINK_ERROR_TOO_MANY_REQUESTS =
0x05
- UPLINK_ERROR_BANDWIDTH_LIMIT_EXCEEDED =
0x06
- UPLINK_ERROR_STORAGE_LIMIT_EXCEEDED =
0x07
- UPLINK_ERROR_SEGMENTS_LIMIT_EXCEEDED =
0x08
- UPLINK_ERROR_BUCKET_NAME_INVALID =
0x10
- UPLINK_ERROR_BUCKET_ALREADY_EXISTS =
0x11
- UPLINK_ERROR_BUCKET_NOT_EMPTY =
0x12
- UPLINK_ERROR_BUCKET_NOT_FOUND =
0x13
- UPLINK_ERROR_OBJECT_KEY_INVALID =
0x20
- UPLINK_ERROR_OBJECT_NOT_FOUND =
0x21
- UPLINK_ERROR_UPLOAD_DONE =
0x22
- EDGE_ERROR_AUTH_DIAL_FAILED =
0x30
- EDGE_ERROR_REGISTER_ACCESS_FAILED =
0x31
- CODE_TO_ERROR_MAPPING =
{
UPLINK_ERROR_INTERNAL => InternalError,
UPLINK_ERROR_CANCELED => CanceledError,
UPLINK_ERROR_INVALID_HANDLE => InvalidHandleError,
UPLINK_ERROR_TOO_MANY_REQUESTS => TooManyRequestError,
UPLINK_ERROR_BANDWIDTH_LIMIT_EXCEEDED => BandwidthLimitExceededError,
UPLINK_ERROR_STORAGE_LIMIT_EXCEEDED => StorageLimitExceededError,
UPLINK_ERROR_SEGMENTS_LIMIT_EXCEEDED => SegmentsLimitExceededError,
UPLINK_ERROR_BUCKET_NAME_INVALID => BucketNameInvalidError,
UPLINK_ERROR_BUCKET_ALREADY_EXISTS => BucketAlreadyExistsError,
UPLINK_ERROR_BUCKET_NOT_EMPTY => BucketNotEmptyError,
UPLINK_ERROR_BUCKET_NOT_FOUND => BucketNotFoundError,
UPLINK_ERROR_OBJECT_KEY_INVALID => ObjectKeyInvalidError,
UPLINK_ERROR_OBJECT_NOT_FOUND => ObjectKeyNotFoundError,
UPLINK_ERROR_UPLOAD_DONE => UploadDoneError,
EDGE_ERROR_AUTH_DIAL_FAILED => EdgeAuthDialFailedError,
EDGE_ERROR_REGISTER_ACCESS_FAILED => EdgeRegisterAccessFailedError
}.freeze
Class Method Summary
collapse
Class Method Details
.derive_encryption_key(passphrase, salt, length) ⇒ Object
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/uplink.rb', line 46
def derive_encryption_key(passphrase, salt, length)
raise ArgumentError, 'salt argument is not a string' unless salt.is_a?(String)
result = UplinkLib.uplink_derive_encryption_key(passphrase, salt, length)
ErrorUtil.handle_result_error(result)
yield result[:encryption_key]
ensure
UplinkLib.uplink_free_encryption_key_result(result) if result
end
|
.internal_universe_is_empty? ⇒ Boolean
57
58
59
|
# File 'lib/uplink.rb', line 57
def internal_universe_is_empty?
UplinkLib.uplink_internal_UniverseIsEmpty != 0
end
|
.parse_access(access_string) ⇒ Object
.request_access_with_passphrase(satellite_address, api_key, passphrase) ⇒ Object
26
27
28
29
30
31
32
33
|
# File 'lib/uplink.rb', line 26
def request_access_with_passphrase(satellite_address, api_key, passphrase)
result = UplinkLib.uplink_request_access_with_passphrase(satellite_address, api_key, passphrase)
ErrorUtil.handle_result_error(result)
yield Access.new(result)
ensure
UplinkLib.uplink_free_access_result(result) if result
end
|
.request_access_with_passphrase_and_config(config, satellite_address, api_key, passphrase) ⇒ Object
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/uplink.rb', line 35
def request_access_with_passphrase_and_config(config, satellite_address, api_key, passphrase)
config_options = UplinkUtil.build_uplink_config(config)
result = UplinkLib.uplink_config_request_access_with_passphrase(config_options, satellite_address, api_key, passphrase)
ErrorUtil.handle_result_error(result)
yield Access.new(result)
ensure
UplinkLib.uplink_free_access_result(result) if result
end
|