What in the API causes GET?

@happybeing Here’s some info about GETs/mutations in the API provided by Client Libs. It should closely mirror the Javascript API we provide but if there is any confusion let me know, it’s also not a complete list yet.

Also, feel free to give suggestions for improvement for when we release an official guide/reference. I’m thinking of moving this to table format but I don’t know if it’s possible on these forums.


MutableData

mdata_put - 1 mut
mdata_get_version - 1 GET
mdata_serialised_size - 1 GET
mdata_get_value - 1 GET
mdata_entries - 1 GET
mdata_list_keys - 1 GET
mdata_list_values - 1 GET
mdata_mutate_entries - 1 mut
mdata_list_permissions - 1 GET
mdata_list_user_permissions - 1 GET
mdata_set_user_permissions - 1 mut
mdata_del_user_permissions - 1 mut


MDataInfo

mdata_info_new_private - 0 GET
mdata_info_random_public - 0 GET
mdata_info_random_private - 0 GET

all mdata_info_* functions - 0 GET


ImmutableData

idata_new_self_encryptor - 0 GET
idata_write_to_self_encryptor - 0 GET, 0 mut, done locally until SE is closed
idata_close_self_encryptor - 1 mut
idata_fetch_self_encryptor - 1 GET
idata_serialised_size - 1 GET
idata_size - 0 GET
idata_read_from_self_encryptor - 0 GET
idata_self_encryptor_writer_free - 0 GET
idata_self_encryptor_reader_free - 0 GET

Notes

  • The actual number of GETs and mutations depends on the size of the data. Any idata at least 3kb in size will be self-encrypted to at least 3 chunks. Smaller than that, and the entire idata is held in the datamap. Each chunk is a separate GET/mutation. The maximum size of a single chunk is 3mb. So keep in mind that getting a whole idata will almost always be more expensive than e.g. getting the size.

Entry Actions

all mdata_entry_action_* functions - 0 GET

Note that all queue’d up actions perform a single mutation total when mdata_mutate_entries is called.


NFS

dir_fetch_file - 1 GET
dir_insert_file - 1 GET, 1 mut
dir_update_file - 1 GET, 1 mut
dir_delete_file - 1 mut

file_open - 0 or 1 GET (to get the datamap if reading or writing in APPEND mode), +3 GET for medium files (except in OVERWRITE mode)
file_size - 0 GET
file_read - 0 GET
file_write - 0 GET
file_close (writing only) - 1 mut (to put the new datamap), +3 mut for a medium file

Notes

  • file_open initially does 3 GETs for a medium file when writing in APPEND mode, same as reading. We need to get the existing data and decrypt so we can re-encrypt it again after writing – in OVERWRITE mode the existing data doesn’t matter.
  • The amount of muts by file_close depends on the file size after writing, as you can open a small file and it can be medium or large by the time you’re done writing.
5 Likes