Skip to content
しずえ edited this page Oct 11, 2020 · 6 revisions

Architecture

Expect action defines a kind of request that the token is authorized to perform on chunks. Expect actions are defined on sets of chunks. Expectations are fulfilled when the action was performed on all of them.

An expect action can be cancelled. Depending on the type of the expected action, a clean up routine may be performed. For WRITE action, if any of the chunks from the set were already written, then canceling this action would remove these chunks from the database.

Expect actions are also immutable. Once NS send an expect action request to FS, consequent requests to the same token will be ignored and an error status returned. Idea is that for each expectation, there should be a unique token.

Client

Syncing data

Client will be responsible for syncing data with the server and performing various operations on the data.

Terminology:

Given a path /a/b/c.e its parent is /a/b, base is c and extension is e. Parent of / is /. The entities that are located inside directories are called files: includes directories and files.

Mirror management

Initialization

$ tsuki init path/to/directory nsaddr

Effects: If connection to the server is successful, removes any content from the directory and downloads the files from the server.

Synchronization

$ tsuki sync

Requires: the command should be executed inside the root of the mirror.

Effects: If connection to the nsaddr that was used to initialize the mirror is successful, asks NS for any updates, and redownloads files if necessary.

File management

One can bypass creation of the mirror and access the bootstrap mode that will allow to selectively download/upload files, manage file system structure right from the tsuki console.

Run bootstrap mode by running

$ tsuki nsaddr

Additionally, just like in usual console paths can be relative and absolute, without and with a leading slash respectively.

Create file

tsuki $ touch /path/to/file

Requires: The provided path with omitted file name exists.

Effects: Creates an empty file at the provided path.

Move file

tsuki $ mv /path/to/file /new/path/newfile

Requires: The file exists and new path's parent should exist.

Effects: If path to newfile is a directory, the contents of the file are moved to that directory and the name is preserved. If path to newfile is a file or does not exists, the contents of the file are moved to the parent and the file is renamed to newfile.

Remove file

tsuki $ rm /path/to/file

Requires: The file exists.

Effects: The file is removed. If file is a directory, it is removed recursively.

Copy file

tsuki $ cp /path/to/file /path/to/newfile

Requires: The file to exists, and parent of the newfile to exist.

Effects: If newobj exists and is a directory, obj is copied