arrow-left

All pages
gitbookPowered by GitBook
1 of 3

Loading...

Loading...

Loading...

Bucket Operation

hashtag
Create bucket

Command description: Enter createBucket to create a bucket according to the BucketName. Each bucket can be set with a different redundancy policy. The redundancy policy is multi-replica or erasure code. The redundancy level can be determined by adjusting the number of the data block and parity block. 3 data blocks and erasure code of 2 parity blocks are used by default, the loss of two blocks is tolerable.

mefs provides dedicated encrypted storage space (LFS) for each user, each storage space contains multiple buckets, buckets are containers that users use to store objects, and each bucket contains multiple objects. We can think of objects as files. The redundancy policy of a bucket can be specified at creation time (all objects stored in the bucket use this redundancy policy).

When creating a bucket policy, the value of dc+pc should be less than the number of providers in the group where the current user belongs. Users can modify the number of dc and pc according to their own needs.

hashtag
Check bucket list

Command description: Enter listBuckets to display all buckets created by this user, including the name of each bucket, creation time, redundancy policy and redundancy parameters (DataCount, ParityCount).

hashtag
Check bucket information

Command description: If BucketName exists, entering headBucket displays its creation time, redundancy policy and redundancy parameters. If BucketName does not exist, it displays that bucket does not exist.

mefs-user lfs createBucket --bn=test2 --dc=3 --pc=6	
mefs-user lfs listBuckets
Name: test2				
Bucket ID: 2
Creation Time: 2022-03-23 14:42:06 CST
Modify Time: 2022-03-23 14:42:06 CST
Object Count: 0
Policy: erasure code				
Data Count: 3								
Parity Count: 6				
Reliability: High
Used Bytes: 0 B
List buckets:

Name: test
Bucket ID: 1
Creation Time: 2022-03-23 14:25:41 CST
Modify Time: 2022-03-23 14:38:44 CST
Object Count: 1
Policy: erasure code
Data Count: 7
Parity Count: 7
Reliability: High
Used Bytes: 10.17 MiB

Name: test2
Bucket ID: 2
Creation Time: 2022-03-23 14:42:06 CST
Modify Time: 2022-03-23 14:42:06 CST
Object Count: 0
Policy: erasure code
Data Count: 3
Parity Count: 6
Reliability: High
Used Bytes: 0 B
mefs-user lfs headBucket --bn=test2
Head bucket:
Name: test2
Bucket ID: 2
Creation Time: 2022-03-23 14:42:06 CST
Modify Time: 2022-03-23 14:42:06 CST
Object Count: 0
Policy: erasure code
Data Count: 3
Parity Count: 6
Reliability: High
Used Bytes: 0 B

Upload and Download

hashtag
Upload file

Command description: Entering putObject to upload an object named ObjectName into BucketName; if the bucket does not exist, it will display that the bucket does not exist; if the object already exists, it will display that the object already exists.

echo "hello MEMO" >~/test.file
mefs-user lfs putObject --bn=test2 --on=obj1 --path=~/test.file

hashtag
Check file information

Command description: Enter listObjects to list all objects in BucketName, including object size, creation time, MD5 value, and the most recent challenge time.

hashtag
Download file

Command description: Enter getObject to download an object named ObjectName from BucketName; if the bucket does not exist, it displays that the bucket does not exist; if the object does not exist, it displays that the object does not exist.

{"level":"DEBUG","time":"2022-03-23T15:20:32+08:00","logger":"httpio","caller":"httpio/reader.go:51","msg":"push stream: /rpc/streams/v0/push/fce925c8-7d24-4cf7-9d3f-0a370fa69d85"}
Put object:
Name: obj1
Bucket ID: 2
Object ID: 0
ETag: b1946ac92492d2347c6235b4d2611184
Size: 6 B
UsedBytes: 2.18 MiB
Enc Method: aes
State: total 9, dispatch 0, done 0, confirm 0
Creation Time: 2022-03-23 15:20:32 CST
Modify Time: 2022-03-23 15:20:32 CST
mefs-user lfs listObjects --bn=test2
List objects:

Name: obj1
Bucket ID: 2
Object ID: 0
ETag: b1946ac92492d2347c6235b4d2611184
Size: 6 B
UsedBytes: 2.18 MiB
Enc Method: aes
State: total 9, dispatch 2, done 2, confirm 0
Creation Time: 2022-03-23 15:20:32 CST
Modify Time: 2022-03-23 15:20:32 CST
mefs-user lfs getObject --bn=test2 --on=obj1 --path=~/test.txt
download: 100% [=======================================================================================================================] ( 6/ 6B, 0.302 kB/s)
object: obj1 (etag: b1946ac92492d2347c6235b4d2611184) is stored in: /home/mtest/test.txt

How to use