Documentation ¶
Overview ¶
Package mobile contains the simplified mobile APIs to Storj Network.
For API limitations see https://github.com/ethereum/go-ethereum/blob/461291882edce0ac4a28f64c4e8725b7f57cbeae/mobile/doc.go#L23
build loop for development
watchrun gobind -lang=java -outdir=../mobile-out storj.io/storj/mobile == pt skipped ../mobile-out
gomobile bind -target android
To use:
gomobile bind -target android
Create a new project in AndroidStudio ¶
Copy mobile-source.jar and mobile.aar into `AndroidStudioProjects\MyApplication\app\libs\`
Modify build.gradle to also find *.aar files:
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
See example Java file
Index ¶
- Constants
- type Bucket
- func (bucket *Bucket) Close() error
- func (bucket *Bucket) DeleteObject(objectPath string) error
- func (bucket *Bucket) ListObjects(options *ListOptions) (*ObjectList, error)
- func (bucket *Bucket) NewReader(path storj.Path, options *ReaderOptions) (*Reader, error)
- func (bucket *Bucket) NewWriter(path storj.Path, options *WriterOptions) (*Writer, error)
- func (bucket *Bucket) OpenObject(objectPath string) (*ObjectInfo, error)
- type BucketAccess
- type BucketConfig
- type BucketInfo
- type BucketList
- type Config
- type EncryptionParameters
- type ListOptions
- type ObjectInfo
- type ObjectList
- type Project
- func (project *Project) Close() error
- func (project *Project) CreateBucket(bucketName string, opts *BucketConfig) (*BucketInfo, error)
- func (project *Project) DeleteBucket(bucketName string) error
- func (project *Project) GetBucketInfo(bucketName string) (*BucketInfo, error)
- func (project *Project) ListBuckets(cursor string, direction, limit int) (*BucketList, error)
- func (project *Project) OpenBucket(bucketName string, options *BucketAccess) (*Bucket, error)
- type ProjectOptions
- type Reader
- type ReaderOptions
- type RedundancyScheme
- type Uplink
- type Writer
- type WriterOptions
Constants ¶
const ( // CipherSuiteEncUnspecified indicates no encryption suite has been selected. CipherSuiteEncUnspecified = byte(storj.EncUnspecified) // CipherSuiteEncNull indicates use of the NULL cipher; that is, no encryption is // done. The ciphertext is equal to the plaintext. CipherSuiteEncNull = byte(storj.EncNull) // CipherSuiteEncAESGCM indicates use of AES128-GCM encryption. CipherSuiteEncAESGCM = byte(storj.EncAESGCM) // CipherSuiteEncSecretBox indicates use of XSalsa20-Poly1305 encryption, as provided // by the NaCl cryptography library under the name "Secretbox". CipherSuiteEncSecretBox = byte(storj.EncSecretBox) // DirectionAfter lists forwards from cursor, without cursor DirectionAfter = int(storj.After) // DirectionForward lists forwards from cursor, including cursor DirectionForward = int(storj.Forward) // DirectionBackward lists backwards from cursor, including cursor DirectionBackward = int(storj.Backward) // DirectionBefore lists backwards from cursor, without cursor DirectionBefore = int(storj.Before) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct { Name string // contains filtered or unexported fields }
Bucket represents operations you can perform on a bucket
func (*Bucket) DeleteObject ¶
DeleteObject removes an object, if authorized.
func (*Bucket) ListObjects ¶
func (bucket *Bucket) ListObjects(options *ListOptions) (*ObjectList, error)
ListObjects list objects in bucket, if authorized.
func (*Bucket) OpenObject ¶
func (bucket *Bucket) OpenObject(objectPath string) (*ObjectInfo, error)
OpenObject returns an Object handle, if authorized.
type BucketAccess ¶
BucketAccess defines access to bucket
type BucketConfig ¶
type BucketConfig struct { // PathCipher indicates which cipher suite is to be used for path // encryption within the new Bucket. If not set, AES-GCM encryption // will be used. PathCipher byte // EncryptionParameters specifies the default encryption parameters to // be used for data encryption of new Objects in this bucket. EncryptionParameters *EncryptionParameters // RedundancyScheme defines the default Reed-Solomon and/or // Forward Error Correction encoding parameters to be used by // objects in this Bucket. RedundancyScheme *RedundancyScheme // SegmentsSize is the default segment size to use for new // objects in this Bucket. SegmentsSize int64 }
BucketConfig bucket configuration
type BucketInfo ¶
type BucketInfo struct { Name string Created int64 PathCipher byte SegmentsSize int64 RedundancyScheme *RedundancyScheme EncryptionParameters *EncryptionParameters }
BucketInfo bucket meta struct
type BucketList ¶
type BucketList struct {
// contains filtered or unexported fields
}
BucketList is a list of buckets
func (*BucketList) Item ¶
func (bl *BucketList) Item(index int) (*BucketInfo, error)
Item gets item from specific index
func (*BucketList) Length ¶
func (bl *BucketList) Length() int
Length returns number of returned items
func (*BucketList) More ¶
func (bl *BucketList) More() bool
More returns true if list request was not able to return all results
type Config ¶
type Config struct { // MaxInlineSize determines whether the uplink will attempt to // store a new object in the satellite's metainfo. Objects at // or below this size will be marked for inline storage, and // objects above this size will not. (The satellite may reject // the inline storage and require remote storage, still.) MaxInlineSize int64 // MaxMemory is the default maximum amount of memory to be // allocated for read buffers while performing decodes of // objects. (This option is overrideable per Bucket if the user // so desires.) If set to zero, the library default (4 MiB) will // be used. If set to a negative value, the system will use the // smallest amount of memory it can. MaxMemory int64 }
Config represents configuration options for an Uplink
type EncryptionParameters ¶
type EncryptionParameters struct { // CipherSuite specifies the cipher suite to be used for encryption. CipherSuite byte // BlockSize determines the unit size at which encryption is performed. // It is important to distinguish this from the block size used by the // cipher suite (probably 128 bits). There is some small overhead for // each encryption unit, so BlockSize should not be too small, but // smaller sizes yield shorter first-byte latency and better seek times. // Note that BlockSize itself is the size of data blocks _after_ they // have been encrypted and the authentication overhead has been added. // It is _not_ the size of the data blocks to _be_ encrypted. BlockSize int32 }
EncryptionParameters is the cipher suite and parameters used for encryption It is like EncryptionScheme, but uses the CipherSuite type instead of Cipher. EncryptionParameters is preferred for new uses.
type ListOptions ¶
type ListOptions struct { Prefix string Cursor string // Cursor is relative to Prefix, full path is Prefix + Cursor Delimiter int32 Recursive bool Direction int Limit int }
ListOptions options for listing objects
type ObjectInfo ¶
type ObjectInfo struct { Version int32 Bucket string Path string IsPrefix bool Size int64 ContentType string Created int64 Modified int64 Expires int64 // contains filtered or unexported fields }
ObjectInfo object metadata
func (*ObjectInfo) GetMetadata ¶
func (bl *ObjectInfo) GetMetadata(key string) string
GetMetadata gets objects custom metadata
type ObjectList ¶
type ObjectList struct {
// contains filtered or unexported fields
}
ObjectList represents list of objects
func (*ObjectList) Item ¶
func (bl *ObjectList) Item(index int) (*ObjectInfo, error)
Item gets item from specific index
func (*ObjectList) Length ¶
func (bl *ObjectList) Length() int
Length returns number of returned items
func (*ObjectList) More ¶
func (bl *ObjectList) More() bool
More returns true if list request was not able to return all results
func (*ObjectList) Prefix ¶
func (bl *ObjectList) Prefix() string
Prefix prefix for objects from list
type Project ¶
type Project struct {
// contains filtered or unexported fields
}
Project represents a specific project access session.
func (*Project) CreateBucket ¶
func (project *Project) CreateBucket(bucketName string, opts *BucketConfig) (*BucketInfo, error)
CreateBucket creates buckets in project
func (*Project) DeleteBucket ¶
DeleteBucket deletes a bucket if authorized. If the bucket contains any Objects at the time of deletion, they may be lost permanently.
func (*Project) GetBucketInfo ¶
func (project *Project) GetBucketInfo(bucketName string) (*BucketInfo, error)
GetBucketInfo returns info about the requested bucket if authorized.
func (*Project) ListBuckets ¶
func (project *Project) ListBuckets(cursor string, direction, limit int) (*BucketList, error)
ListBuckets will list authorized buckets.
func (*Project) OpenBucket ¶
func (project *Project) OpenBucket(bucketName string, options *BucketAccess) (*Bucket, error)
OpenBucket returns a Bucket handle with the given EncryptionAccess information.
type ProjectOptions ¶
type ProjectOptions struct {
EncryptionKey []byte
}
ProjectOptions allows configuration of various project options during opening
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader reader for downloading object
type RedundancyScheme ¶
type RedundancyScheme struct { // Algorithm determines the algorithm to be used for redundancy. Algorithm byte ShareSize int32 // segment. RequiredShares int16 // before a repair is triggered. RepairShares int16 OptimalShares int16 // OptimalShares, slower uploads of the excess shares will be aborted in // order to improve performance. TotalShares int16 }
RedundancyScheme specifies the parameters and the algorithm for redundancy
type Uplink ¶
type Uplink struct {
// contains filtered or unexported fields
}
Uplink represents the main entrypoint to Storj V3. An Uplink connects to a specific Satellite and caches connections and resources, allowing one to create sessions delineated by specific access controls.
func NewUplink ¶
NewUplink creates a new Uplink. This is the first step to create an uplink session with a user specified config or with default config, if nil config. Uplink needs also writable temporary directory.
func (*Uplink) Close ¶
Close closes the Uplink. This may not do anything at present, but should still be called to allow forward compatibility. No Project or Bucket objects using this Uplink should be used after calling Close.
func (*Uplink) OpenProject ¶
func (uplink *Uplink) OpenProject(satellite string, apikey string, options *ProjectOptions) (*Project, error)
OpenProject returns a Project handle with the given APIKey
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer writes data into object
type WriterOptions ¶
type WriterOptions struct { // ContentType, if set, gives a MIME content-type for the Object. ContentType string // Metadata contains additional information about an Object. It can // hold arbitrary textual fields and can be retrieved together with the // Object. Field names can be at most 1024 bytes long. Field values are // not individually limited in size, but the total of all metadata // (fields and values) can not exceed 4 kiB. Metadata map[string]string // Expires is the time at which the new Object can expire (be deleted // automatically from storage nodes). Expires int // EncryptionParameters determines the cipher suite to use for // the Object's data encryption. If not set, the Bucket's // defaults will be used. EncryptionParameters *EncryptionParameters // RedundancyScheme determines the Reed-Solomon and/or Forward // Error Correction encoding parameters to be used for this // Object. RedundancyScheme *RedundancyScheme }
WriterOptions controls options about writing a new Object
func NewWriterOptions ¶
func NewWriterOptions() *WriterOptions
NewWriterOptions creates writer options