Skip to content

Commit

Permalink
* Renamed 'system.method.*' to 'method.*'.
Browse files Browse the repository at this point in the history
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1139 e378c898-3ddf-0310-93e7-cc216c733640
  • Loading branch information
rakshasa committed Mar 3, 2010
1 parent db8f217 commit 44e7701
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 101 deletions.
32 changes: 16 additions & 16 deletions src/command_dynamic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ create_new_key(const std::string& key, const char postfix[postfix_size]) {
return buffer;
}

// system.method.insert <generic> {name, "simple|private|const", ...}
// system.method.insert <generic> {name, "multi|private|const"}
// system.method.insert <generic> {name, "value|private|const"}
// system.method.insert <generic> {name, "value|private|const", value}
// system.method.insert <generic> {name, "bool|private|const"}
// system.method.insert <generic> {name, "bool|private|const", bool}
// system.method.insert <generic> {name, "string|private|const"}
// system.method.insert <generic> {name, "string|private|const", string}
// method.insert <generic> {name, "simple|private|const", ...}
// method.insert <generic> {name, "multi|private|const"}
// method.insert <generic> {name, "value|private|const"}
// method.insert <generic> {name, "value|private|const", value}
// method.insert <generic> {name, "bool|private|const"}
// method.insert <generic> {name, "bool|private|const", bool}
// method.insert <generic> {name, "string|private|const"}
// method.insert <generic> {name, "string|private|const", string}
//
// Add a new user-defined method called 'name' and any number of
// lines.
Expand Down Expand Up @@ -172,7 +172,7 @@ system_method_insert(__UNUSED rpc::target_type target, const torrent::Object& ra
return torrent::Object();
}

// system.method.erase <> {name}
// method.erase <> {name}
//
// Erase a modifiable method called 'name. Trying to remove methods
// that aren't modifiable, e.g. defined by rtorrent or set to
Expand Down Expand Up @@ -284,11 +284,11 @@ system_method_list_keys(__UNUSED rpc::target_type target, const torrent::Object&

void
initialize_command_dynamic() {
CMD_N ("system.method.insert", rak::ptr_fn(&system_method_insert));
CMD_N_STRING("system.method.erase", rak::ptr_fn(&system_method_erase));
CMD_N_STRING("system.method.get", rak::ptr_fn(&system_method_get));
CMD_N ("system.method.set", rak::ptr_fn(&system_method_set));
CMD_N ("system.method.set_key", rak::ptr_fn(&system_method_set_key));
CMD_N ("system.method.has_key", rak::ptr_fn(&system_method_has_key));
CMD_N_STRING("system.method.list_keys", rak::ptr_fn(&system_method_list_keys));
CMD_N ("method.insert", rak::ptr_fn(&system_method_insert));
CMD_N_STRING("method.erase", rak::ptr_fn(&system_method_erase));
CMD_N_STRING("method.get", rak::ptr_fn(&system_method_get));
CMD_N ("method.set", rak::ptr_fn(&system_method_set));
CMD_N ("method.set_key", rak::ptr_fn(&system_method_set_key));
CMD_N ("method.has_key", rak::ptr_fn(&system_method_has_key));
CMD_N_STRING("method.list_keys", rak::ptr_fn(&system_method_list_keys));
}
4 changes: 2 additions & 2 deletions src/command_events.cc
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@ initialize_command_events() {

ADD_VARIABLE_BOOL("check_hash", true); // Rename

rpc::commands.call("system.method.insert", rpc::create_object_list("system.session.use_lock", "bool|const", true));
rpc::commands.call("system.method.insert", rpc::create_object_list("system.session.on_completion", "bool|const", true));
rpc::commands.call("method.insert", rpc::create_object_list("system.session.use_lock", "bool|const", true));
rpc::commands.call("method.insert", rpc::create_object_list("system.session.on_completion", "bool|const", true));

ADD_COMMAND_STRING("on_ratio", rak::ptr_fn(&apply_on_ratio));

Expand Down
28 changes: 14 additions & 14 deletions src/command_local.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,14 @@ group_insert(__UNUSED rpc::target_type target, const torrent::Object& rawArgs) {
const std::string& name = check_name(post_increment(itr, last)->as_string());
const std::string& view = check_name(post_increment(itr, last)->as_string());

rpc::commands.call("system.method.insert", rpc::create_object_list("group." + name + ".view", "string", view));
rpc::commands.call("method.insert", rpc::create_object_list("group." + name + ".view", "string", view));

rpc::commands.call("system.method.insert", rpc::create_object_list("group." + name + ".ratio.enable", "simple", "schedule=group." + name + ".ratio,5,60,on_ratio=" + name));
rpc::commands.call("system.method.insert", rpc::create_object_list("group." + name + ".ratio.disable", "simple", "schedule_remove=group." + name + ".ratio"));
rpc::commands.call("system.method.insert", rpc::create_object_list("group." + name + ".ratio.command", "simple", "d.try_close= ;d.set_ignore_commands=1"));
rpc::commands.call("system.method.insert", rpc::create_object_list("group." + name + ".ratio.min", "value", (int64_t)200));
rpc::commands.call("system.method.insert", rpc::create_object_list("group." + name + ".ratio.max", "value", (int64_t)300));
rpc::commands.call("system.method.insert", rpc::create_object_list("group." + name + ".ratio.upload", "value", (int64_t)20 << 20));
rpc::commands.call("method.insert", rpc::create_object_list("group." + name + ".ratio.enable", "simple", "schedule=group." + name + ".ratio,5,60,on_ratio=" + name));
rpc::commands.call("method.insert", rpc::create_object_list("group." + name + ".ratio.disable", "simple", "schedule_remove=group." + name + ".ratio"));
rpc::commands.call("method.insert", rpc::create_object_list("group." + name + ".ratio.command", "simple", "d.try_close= ;d.set_ignore_commands=1"));
rpc::commands.call("method.insert", rpc::create_object_list("group." + name + ".ratio.min", "value", (int64_t)200));
rpc::commands.call("method.insert", rpc::create_object_list("group." + name + ".ratio.max", "value", (int64_t)300));
rpc::commands.call("method.insert", rpc::create_object_list("group." + name + ".ratio.upload", "value", (int64_t)20 << 20));

return name;
}
Expand All @@ -176,13 +176,13 @@ initialize_command_local() {
ADD_COMMAND_VOID("system.hostname", rak::ptr_fun(&system_hostname));
ADD_COMMAND_VOID("system.pid", rak::ptr_fun(&getpid));

rpc::commands.call("system.method.insert", rpc::create_object_list("system.client_version", "string|static|const", PACKAGE_VERSION));
rpc::commands.call("system.method.insert", rpc::create_object_list("system.library_version", "string|static|const", torrent::version()));
rpc::commands.call("system.method.insert", rpc::create_object_list("system.file.allocate", "value|const", (int64_t)0));
rpc::commands.call("system.method.insert", rpc::create_object_list("system.file.max_size", "value|const", -1));
rpc::commands.call("system.method.insert", rpc::create_object_list("system.file.split_size", "value|const", -1));
rpc::commands.call("system.method.insert", rpc::create_object_list("system.file.split_suffix", "string|const", ".part"));
rpc::commands.call("system.method.insert", rpc::create_object_list("system.session_name", "string|const", ""));
rpc::commands.call("method.insert", rpc::create_object_list("system.client_version", "string|static|const", PACKAGE_VERSION));
rpc::commands.call("method.insert", rpc::create_object_list("system.library_version", "string|static|const", torrent::version()));
rpc::commands.call("method.insert", rpc::create_object_list("system.file.allocate", "value|const", (int64_t)0));
rpc::commands.call("method.insert", rpc::create_object_list("system.file.max_size", "value|const", -1));
rpc::commands.call("method.insert", rpc::create_object_list("system.file.split_size", "value|const", -1));
rpc::commands.call("method.insert", rpc::create_object_list("system.file.split_suffix", "string|const", ".part"));
rpc::commands.call("method.insert", rpc::create_object_list("system.session_name", "string|const", ""));

ADD_COMMAND_VOID("system.file_status_cache.size", rak::make_mem_fun((utils::FileStatusCache::base_type*)control->core()->file_status_cache(),
&utils::FileStatusCache::size));
Expand Down
4 changes: 2 additions & 2 deletions src/command_network.cc
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,6 @@ initialize_command_network() {

ADD_VARIABLE_BOOL("peer_exchange", true);

rpc::commands.call("system.method.insert", rpc::create_object_list("log.handshake", "bool|const", int64_t()));
rpc::commands.call("system.method.insert", rpc::create_object_list("log.tracker", "string|const", ""));
rpc::commands.call("method.insert", rpc::create_object_list("log.handshake", "bool|const", int64_t()));
rpc::commands.call("method.insert", rpc::create_object_list("log.tracker", "string|const", ""));
}
4 changes: 2 additions & 2 deletions src/command_object.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@

void
initialize_command_object() {
// CMD_N ("system.method.insert", rak::ptr_fn(&system_method_insert));
// CMD_N_STRING("system.method.erase", rak::ptr_fn(&system_method_erase));
// CMD_N ("method.insert", rak::ptr_fn(&system_method_insert));
// CMD_N_STRING("method.erase", rak::ptr_fn(&system_method_erase));
}
2 changes: 1 addition & 1 deletion src/command_scheduler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ initialize_command_scheduler() {

// CMD_G("scheduler.active", rak::bind_ptr_fn(&cmd_call, "view.size=active"));

rpc::commands.call("system.method.insert", rpc::create_object_list("scheduler.max_active", "value", (int64_t)-1));
rpc::commands.call("method.insert", rpc::create_object_list("scheduler.max_active", "value", (int64_t)-1));

CMD_D_ANY("scheduler.simple.added", rak::ptr_fn(&cmd_scheduler_simple_added));
CMD_D_ANY("scheduler.simple.removed", rak::ptr_fn(&cmd_scheduler_simple_removed));
Expand Down
4 changes: 2 additions & 2 deletions src/core/view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ View::set_filter_on_event(const std::string& event) {
if (std::find(m_events.begin(), m_events.end(), event) != m_events.end())
return;

rpc::commands.call_catch("system.method.set_key", rpc::make_target(), rpc::create_object_list(event, "!view_" + m_name, "view.filter_download=" + m_name));
rpc::commands.call_catch("method.set_key", rpc::make_target(), rpc::create_object_list(event, "!view_" + m_name, "view.filter_download=" + m_name));
m_events.push_back(event);
}

Expand All @@ -303,7 +303,7 @@ View::clear_filter_on() {
// Don't clear insert and erase as these are required to keep the
// View up-to-date with the available downloads.
for (event_list_type::const_iterator itr = m_events.begin(); itr != m_events.end(); itr++)
rpc::commands.call_catch("system.method.set_key", rpc::make_target(), rpc::create_object_list(*itr, "!view_" + m_name));
rpc::commands.call_catch("method.set_key", rpc::make_target(), rpc::create_object_list(*itr, "!view_" + m_name));
}

inline void
Expand Down
128 changes: 66 additions & 62 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,47 +188,47 @@ main(int argc, char** argv) {

rpc::parse_command_multiple
(rpc::make_target(),
// "system.method.insert = test.value,value\n"
// "system.method.insert = test.value2,value,6\n"

// "system.method.insert = test.string,string,6\n"
// "system.method.insert = test.bool,bool,true\n"

"system.method.insert = test.method.simple,simple,\"print=simple_test_,$argument.0=\"\n"

"system.method.insert = event.download.inserted,multi\n"
"system.method.insert = event.download.inserted_new,multi\n"
"system.method.insert = event.download.inserted_session,multi\n"
"system.method.insert = event.download.erased,multi\n"
"system.method.insert = event.download.opened,multi\n"
"system.method.insert = event.download.closed,multi\n"
"system.method.insert = event.download.resumed,multi\n"
"system.method.insert = event.download.paused,multi\n"
// "method.insert = test.value,value\n"
// "method.insert = test.value2,value,6\n"

// "method.insert = test.string,string,6\n"
// "method.insert = test.bool,bool,true\n"

"method.insert = test.method.simple,simple,\"print=simple_test_,$argument.0=\"\n"

"method.insert = event.download.inserted,multi\n"
"method.insert = event.download.inserted_new,multi\n"
"method.insert = event.download.inserted_session,multi\n"
"method.insert = event.download.erased,multi\n"
"method.insert = event.download.opened,multi\n"
"method.insert = event.download.closed,multi\n"
"method.insert = event.download.resumed,multi\n"
"method.insert = event.download.paused,multi\n"

"system.method.insert = event.download.finished,multi\n"
"system.method.insert = event.download.hash_done,multi\n"
"system.method.insert = event.download.hash_failed,multi\n"
"system.method.insert = event.download.hash_final_failed,multi\n"
"system.method.insert = event.download.hash_removed,multi\n"
"system.method.insert = event.download.hash_queued,multi\n"

"system.method.set_key = event.download.inserted, 1_connect_logs, d.initialize_logs=\n"
"system.method.set_key = event.download.inserted_new, 1_prepare, \"branch=d.get_state=,view.set_visible=started,view.set_visible=stopped ;d.save_full_session=\"\n"
"system.method.set_key = event.download.inserted_session, 1_prepare, \"branch=d.get_state=,view.set_visible=started,view.set_visible=stopped\"\n"

"system.method.set_key = event.download.erased, !_download_list, ui.unfocus_download=\n"
"system.method.set_key = event.download.erased, ~_delete_tied, d.delete_tied=\n"

"system.method.insert = ratio.enable, simple|const,group.seeding.ratio.enable=\n"
"system.method.insert = ratio.disable,simple|const,group.seeding.ratio.disable=\n"
"system.method.insert = ratio.min, simple|const,group.seeding.ratio.min=\n"
"system.method.insert = ratio.max, simple|const,group.seeding.ratio.max=\n"
"system.method.insert = ratio.upload, simple|const,group.seeding.ratio.upload=\n"
"system.method.insert = ratio.min.set, simple|const,group.seeding.ratio.min.set=$argument.0=\n"
"system.method.insert = ratio.max.set, simple|const,group.seeding.ratio.max.set=$argument.0=\n"
"system.method.insert = ratio.upload.set,simple|const,group.seeding.ratio.upload.set=$argument.0=\n"

"system.method.insert = group.insert_persistent_view,simple|const,"
"method.insert = event.download.finished,multi\n"
"method.insert = event.download.hash_done,multi\n"
"method.insert = event.download.hash_failed,multi\n"
"method.insert = event.download.hash_final_failed,multi\n"
"method.insert = event.download.hash_removed,multi\n"
"method.insert = event.download.hash_queued,multi\n"

"method.set_key = event.download.inserted, 1_connect_logs, d.initialize_logs=\n"
"method.set_key = event.download.inserted_new, 1_prepare, \"branch=d.get_state=,view.set_visible=started,view.set_visible=stopped ;d.save_full_session=\"\n"
"method.set_key = event.download.inserted_session, 1_prepare, \"branch=d.get_state=,view.set_visible=started,view.set_visible=stopped\"\n"

"method.set_key = event.download.erased, !_download_list, ui.unfocus_download=\n"
"method.set_key = event.download.erased, ~_delete_tied, d.delete_tied=\n"

"method.insert = ratio.enable, simple|const,group.seeding.ratio.enable=\n"
"method.insert = ratio.disable,simple|const,group.seeding.ratio.disable=\n"
"method.insert = ratio.min, simple|const,group.seeding.ratio.min=\n"
"method.insert = ratio.max, simple|const,group.seeding.ratio.max=\n"
"method.insert = ratio.upload, simple|const,group.seeding.ratio.upload=\n"
"method.insert = ratio.min.set, simple|const,group.seeding.ratio.min.set=$argument.0=\n"
"method.insert = ratio.max.set, simple|const,group.seeding.ratio.max.set=$argument.0=\n"
"method.insert = ratio.upload.set,simple|const,group.seeding.ratio.upload.set=$argument.0=\n"

"method.insert = group.insert_persistent_view,simple|const,"
"view_add=$argument.0=,view.persistent=$argument.0=,\"group.insert=$argument.0=,$argument.0=\"\n"

// Allow setting 'group.view' as constant, so that we can't
Expand Down Expand Up @@ -321,28 +321,32 @@ main(int argc, char** argv) {
// - command_tracker.cc
// - command_ui.cc

"system.method.insert = get_handshake_log,redirect|const,log.handshake\n"
"system.method.insert = set_handshake_log,redirect|const,log.handshake.set\n"
"system.method.insert = get_log.tracker,redirect|const,log.tracker\n"
"system.method.insert = set_log.tracker,redirect|const,log.tracker.set\n"

"system.method.insert = get_name,redirect|const,system.session_name\n"
"system.method.insert = set_name,redirect|const,system.session_name.set\n"
"system.method.insert = system.file_allocate,redirect|const,system.file.allocate\n"
"system.method.insert = system.file_allocate.set,redirect|const,system.file.allocate.set\n"

"system.method.insert = get_preload_type,redirect|const,pieces.preload.type\n"
"system.method.insert = get_preload_min_size,redirect|const,pieces.preload.min_size\n"
"system.method.insert = get_preload_required_rate,redirect|const,pieces.preload.min_rate\n"
"system.method.insert = set_preload_type,redirect|const,pieces.preload.type.set\n"
"system.method.insert = set_preload_min_size,redirect|const,pieces.preload.min_size.set\n"
"system.method.insert = set_preload_required_rate,redirect|const,pieces.preload.min_rate.set\n"
"system.method.insert = get_stats_preloaded,redirect|const,pieces.stats_preloaded\n"
"system.method.insert = get_stats_not_preloaded,redirect|const,pieces.stats_not_preloaded\n"

"system.method.insert = get_memory_usage,redirect|const,pieces.memory.current\n"
"system.method.insert = get_max_memory_usage,redirect|const,pieces.memory.max\n"
"system.method.insert = set_max_memory_usage,redirect|const,pieces.memory.max.set\n"
"method.insert = system.method.insert,redirect|const,method.insert\n"
"method.insert = system.method.set,redirect|const,method.set\n"
"method.insert = system.method.set_key,redirect|const,method.set_key\n"

"method.insert = get_handshake_log,redirect|const,log.handshake\n"
"method.insert = set_handshake_log,redirect|const,log.handshake.set\n"
"method.insert = get_log.tracker,redirect|const,log.tracker\n"
"method.insert = set_log.tracker,redirect|const,log.tracker.set\n"

"method.insert = get_name,redirect|const,system.session_name\n"
"method.insert = set_name,redirect|const,system.session_name.set\n"
"method.insert = system.file_allocate,redirect|const,system.file.allocate\n"
"method.insert = system.file_allocate.set,redirect|const,system.file.allocate.set\n"

"method.insert = get_preload_type,redirect|const,pieces.preload.type\n"
"method.insert = get_preload_min_size,redirect|const,pieces.preload.min_size\n"
"method.insert = get_preload_required_rate,redirect|const,pieces.preload.min_rate\n"
"method.insert = set_preload_type,redirect|const,pieces.preload.type.set\n"
"method.insert = set_preload_min_size,redirect|const,pieces.preload.min_size.set\n"
"method.insert = set_preload_required_rate,redirect|const,pieces.preload.min_rate.set\n"
"method.insert = get_stats_preloaded,redirect|const,pieces.stats_preloaded\n"
"method.insert = get_stats_not_preloaded,redirect|const,pieces.stats_not_preloaded\n"

"method.insert = get_memory_usage,redirect|const,pieces.memory.current\n"
"method.insert = get_max_memory_usage,redirect|const,pieces.memory.max\n"
"method.insert = set_max_memory_usage,redirect|const,pieces.memory.max.set\n"
);

if (OptionParser::has_flag('n', argc, argv))
Expand Down

0 comments on commit 44e7701

Please sign in to comment.