static int recv_commit_start (CcnetProcessor *processor, int argc, char **argv) { USE_PRIV; char *session_token; if (argc != 2) { ccnet_processor_send_response (processor, SC_BAD_ARGS, SS_BAD_ARGS, NULL, 0); ccnet_processor_done (processor, FALSE); return -1; } session_token = argv[1]; if (seaf_token_manager_verify_token (seaf->token_mgr, processor->peer_id, session_token, NULL) == 0) { ccnet_processor_send_response (processor, SC_OK, SS_OK, NULL, 0); processor->state = RECV_OBJECT; priv->writer_id = seaf_obj_store_register_async_write (seaf->commit_mgr->obj_store, write_done_cb, processor); priv->registered = TRUE; return 0; } else { ccnet_processor_send_response (processor, SC_ACCESS_DENIED, SS_ACCESS_DENIED, NULL, 0); ccnet_processor_done (processor, FALSE); return -1; } }
static int get_commit_start (CcnetProcessor *processor, int argc, char **argv) { USE_PRIV; GString *buf = g_string_new (NULL); TransferTask *task = ((SeafileGetcommitV3Proc *)processor)->tx_task; SeafBranch *master = NULL; g_return_val_if_fail (task->session_token, -1); /* fs_roots can be non-NULL if transfer is resumed from NET_DOWN. */ if (task->fs_roots != NULL) object_list_free (task->fs_roots); task->fs_roots = object_list_new (); priv->writer_id = seaf_obj_store_register_async_write (seaf->commit_mgr->obj_store, task->repo_id, task->repo_version, commit_write_cb, processor); g_string_printf (buf, "remote %s seafile-putcommit-v3 %s %s", processor->peer_id, task->head, task->session_token); ccnet_processor_send_request (processor, buf->str); g_string_free (buf, TRUE); seaf_branch_unref (master); return 0; }
static int start (CcnetProcessor *processor, int argc, char **argv) { USE_PRIV; TransferTask *task = ((SeafileGetfsProc *)processor)->tx_task; GString *buf = g_string_new (NULL); if (task->session_token) g_string_printf (buf, "remote %s seafile-putfs %s", processor->peer_id, task->session_token); else g_string_printf (buf, "remote %s seafile-putfs", processor->peer_id); ccnet_processor_send_request (processor, buf->str); g_string_free (buf, TRUE); processor->state = REQUEST_SENT; priv->inspect_queue = g_queue_new (); priv->fs_objects = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); priv->writer_id = seaf_obj_store_register_async_write (seaf->fs_mgr->obj_store, fs_object_write_cb, processor); return 0; }
static void register_async_io (CcnetProcessor *processor) { USE_PRIV; priv->registered = TRUE; priv->writer_id = seaf_obj_store_register_async_write (seaf->fs_mgr->obj_store, priv->store_id, priv->repo_version, on_fs_write, processor); }
static void register_async_io (CcnetProcessor *processor) { USE_PRIV; priv->registered = TRUE; priv->reader_id = seaf_obj_store_register_async_read (seaf->fs_mgr->obj_store, on_seafdir_read, processor); priv->stat_id = seaf_obj_store_register_async_stat (seaf->fs_mgr->obj_store, on_seafile_stat, processor); priv->writer_id = seaf_obj_store_register_async_write (seaf->fs_mgr->obj_store, on_fs_write, processor); }
static int start (CcnetProcessor *processor, int argc, char **argv) { USE_PRIV; GString *buf; SeafileGetfsV2Proc *proc = (SeafileGetfsV2Proc *)processor; TransferTask *task = proc->tx_task; buf = g_string_new (NULL); if (!task->is_clone) { SeafBranch *master = seaf_branch_manager_get_branch (seaf->branch_mgr, task->repo_id, "master"); if (!master) { seaf_warning ("Master branch not found for repo %s.\n", task->repo_id); g_string_free (buf, TRUE); ccnet_processor_done (processor, FALSE); return -1; } g_string_printf (buf, "remote %s seafile-putfs-v2 %s %s %s", processor->peer_id, task->session_token, task->head, master->commit_id); seaf_branch_unref (master); } else g_string_printf (buf, "remote %s seafile-putfs-v2 %s %s", processor->peer_id, task->session_token, task->head); ccnet_processor_send_request (processor, buf->str); g_string_free (buf, TRUE); priv->registered = TRUE; priv->writer_id = seaf_obj_store_register_async_write (seaf->fs_mgr->obj_store, task->repo_id, task->repo_version, on_fs_write, processor); return 0; }