storj.model module

Storj model module.

class Bucket(id=None, name=None, status=None, user=None, created=None, storage=None, transfer=None, pubkeys=None, publicPermissions=None, encryptionKey=None)[source]

Bases: steenzout.object.Object

Storage bucket.

A bucket is a logical grouping of files which the user can assign permissions and limits to.

id

str – unique identifier.

name

str – name.

status

str – bucket status (Active, ...).

user

str – user email address.

created

datetime.datetime – time when the bucket was created.

storage

int – storage limit (in GB).

transfer

int – transfer limit (in GB).

pubkeys
delete()[source]
class Contact(address=None, port=None, nodeID=None, lastSeen=None, protocol=None, userAgent=None)[source]

Bases: steenzout.object.Object

Contact.

address

str – hostname or IP address.

port

str – .

nodeID

str – node unique identifier.

lastSeen

str – .

protocol

str – SemVer protocol tag.

userAgent

str

lastSeen
class File(bucket=None, hash=None, mimetype=None, filename=None, size=None, id=None, frame=None)[source]

Bases: steenzout.object.Object

bucket

bucket unique identifier.

hash
mimetype
filename
frame

storj.model.Frame – file frame.

size
shard_manager
content_type
delete()[source]
download()[source]
name
class FilePointer(hash=None, token=None, operation=None, channel=None)[source]

Bases: steenzout.object.Object

File pointer.

Parameters:
  • hash (str) –
  • token (str) – token unique identifier.
  • operation (str) –
  • channel (str) –
hash

str

token

storj.model.Token – token.

operation

str

channel

str

class Frame(id=None, created=None, shards=None, locked=None, user=None, size=None)[source]

Bases: steenzout.object.Object

File staging frame.

id

str – unique identifier.

created

datetime.datetime – time when the bucket was created.

shards

list[Shard] – shards that compose this frame.

class KeyPair(pkey=None, secret=None)[source]

Bases: object

ECDSA key pair.

Parameters:
  • pkey (str) – hexadecimal representation of the private key (secret exponent).
  • secret (str) – master password.
keypair

pycoin.key.Key.Key – BIP0032-style hierarchical wallet.

Raises:NotImplementedError when – a randomness source is not found.
address

() – base58 encoded bitcoin address version of the nodeID.

node_id

(str) – NodeID derived from the public key (RIPEMD160 hash of public key).

private_key

(str) – private key.

public_key

(str) – public key.

class Keyring[source]

Bases: steenzout.object.Object

export_keyring(password, salt, user_pass)[source]
generate()[source]
import_keyring(filepath)[source]
class MerkleTree(leaves, prehashed=True)[source]

Bases: steenzout.object.Object

Simple merkle hash tree. Nodes are stored as strings in rows. Row 0 is the root node, row 1 is its children, row 2 is their children, etc

Arguments
leaves (list[str]/types.generator[str]):
leaves of the tree, as hex digests
leaves

list[str] – leaves of the tree, as hex digests

depth

int – the number of levels in the tree

count

int – the number of nodes in the tree

rows

list[list[str]] – the levels of the tree

depth

Calculates the depth of the tree.

Returns:tree depth.
Return type:(int)
get_level(depth)[source]

Returns the tree row at the specified depth

get_root()[source]

Return the root of the tree

leaves

(list[str]/types.generator[str]) – leaves of the tree.

class Mirror(hash=None, mirrors=None, status=None)[source]

Bases: steenzout.object.Object

Mirror or file replica settings.

hash

str

mirrors

int – number of file replicas.

status

str – current file replica status.

class Shard(id=None, hash=None, size=None, index=None, challenges=None, tree=None, exclude=None)[source]

Bases: steenzout.object.Object

Shard.

id

str – unique identifier.

hash

str – hash of the data.

size

long – size of the shard in bytes.

index

int – numberic index of the shard in the frame.

challenges

list[str] – list of challenge numbers

tree

list[str] – audit merkle tree

exclude

list[str] – list of farmer nodeIDs to exclude

add_challenge(challenge)[source]

Append challenge.

Parameters:challenge (str) –

.

add_tree(tree)[source]

Append tree.

all()[source]
get_private_record()[source]
get_public_record()[source]
class ShardManager(filepath, shard_size, nchallenges=12)[source]

Bases: steenzout.object.Object

File shard manager.

filepath

str – path to the file.

index

int – number of shards for the given file.

nchallenges

int – number of challenges to be generated.

shard_size

int/long – split file in chunks of this size.

shards

list[Shard] – list of shards

filepath

(str) – path to the file.

static hash(data)[source]

Returns ripemd160 of sha256 of a string as a string of hex.

Parameters:data (str) – content to be digested.
Returns:the ripemd160 of sha256 digest.
Return type:(str)
class Token(token=None, bucket=None, operation=None, expires=None, encryptionKey=None)[source]

Bases: steenzout.object.Object

Token.

Parameters:
  • token (str) – token unique identifier.
  • bucket (str) – bucket unique identifier.
  • () (operation) –
  • expires (str) – expiration date, in the RFC3339 format.
  • encryptionKey (str) –
id

str – token unique identifier.

bucket

storj.model.Bucket – bucket.

operation

str

expires

datetime.datetime – expiration date, in UTC.

encryptionKey

str