about summary refs log tree commit diff
path: root/users/fcuny/exp/buckit/README.org
blob: bad0dae1aa5b06d6d5a7c65a848c789b4dc5b1fd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#+TITLE: buckit

~buckit~ is a tool to add files to a GCS bucket.

* Store
=buckit= is a CLI to upload files to a GCS bucket. A *package* belongs to a *bucket*. A bucket can have multiple *packages*. Each package can have multiple *versions*.

When a version of a file is added to a bucket, a record is created in the index.

A record is composed of the following information:
- the version of the file
- the name of the file
- the checksum of the version
- the path in the GCS bucket
- the user who uploaded the version
- the timestamp of when the uploaded happened
- the state of the file

GCS' ACLs are used to change the visibility of the object in the bucket.

The index is a single JSON file stored at the root of the bucket. The keys in the index are the packages. Packages contain a list of versions, in order (the most recent version is the last entry in the list).

A lock is used for both read and write of the file.
** Life cycle of files
*** Deletion
By default, when a file is uploaded, we mark the state has *present*.

Versions can be deleted. This is a soft-delete:
- the state is changed to *tombstone*
- the expiration date for blob is set 30 days in the future

When a file is marked for deletion, it can not be fetched anymore. The state can be changed to be mark as present. In which case the expiration date is removed on the blob.
* CLI
** add
#+begin_src sh
buckit add <package> <file path>
#+end_src
** list
#+begin_src sh
buckit list
#+end_src
** fetch
#+begin_src sh
buckit fetch <package> <version>
#+end_src
** info
#+begin_src sh
buckit info <package> <version>
#+end_src
** delete
#+begin_src sh
buckit delete <package> <version>
#+end_src
** undelete
#+begin_src sh
bucket undelete <package> <version>
#+end_src