This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push: new f6bdbc3 This removes the FILE_WRITE mechanism from the core f6bdbc3 is described below commit f6bdbc303c783e50307b56243b87921c10da6a53 Author: Leif Hedstrom <zw...@apache.org> AuthorDate: Tue Oct 10 16:33:12 2017 -0600 This removes the FILE_WRITE mechanism from the core This eliminates the TS Mgmt APIs as well, and various tests around writing configuration files. This is a step towards getting rid of configuration writing completely, but I'm doing it piecemeal. --- lib/perl/lib/Apache/TS/AdminClient.pm | 43 +++--- mgmt/api/APITestCliRemote.cc | 251 ---------------------------------- mgmt/api/CfgContextManager.cc | 71 ---------- mgmt/api/CfgContextManager.h | 1 - mgmt/api/CoreAPI.cc | 60 -------- mgmt/api/CoreAPI.h | 1 - mgmt/api/CoreAPIRemote.cc | 28 ---- mgmt/api/EventControlMain.cc | 1 - mgmt/api/INKMgmtAPI.cc | 12 -- mgmt/api/NetworkMessage.cc | 3 - mgmt/api/NetworkMessage.h | 1 - mgmt/api/TSControlMain.cc | 36 ----- mgmt/api/include/mgmtapi.h | 20 --- 13 files changed, 21 insertions(+), 507 deletions(-) diff --git a/lib/perl/lib/Apache/TS/AdminClient.pm b/lib/perl/lib/Apache/TS/AdminClient.pm index 920cf71..b0aad94 100644 --- a/lib/perl/lib/Apache/TS/AdminClient.pm +++ b/lib/perl/lib/Apache/TS/AdminClient.pm @@ -31,28 +31,27 @@ use Apache::TS; # Mgmt API command constants, should track ts/mgmtapi.h use constant { TS_FILE_READ => 0, - TS_FILE_WRITE => 1, - TS_RECORD_SET => 2, - TS_RECORD_GET => 3, - TS_PROXY_STATE_GET => 4, - TS_PROXY_STATE_SET => 5, - TS_RECONFIGURE => 6, - TS_RESTART => 7, - TS_BOUNCE => 8, - TS_EVENT_RESOLVE => 9, - TS_EVENT_GET_MLT => 10, - TS_EVENT_ACTIVE => 11, - TS_EVENT_REG_CALLBACK => 12, - TS_EVENT_UNREG_CALLBACK => 13, - TS_EVENT_NOTIFY => 14, - TS_STATS_RESET_NODE => 15, - TS_STORAGE_DEVICE_CMD_OFFLINE => 16, - TS_RECORD_MATCH_GET => 17, - TS_API_PING => 18, - TS_SERVER_BACKTRACE => 19, - TS_RECORD_DESCRIBE_CONFIG => 20, - TS_LIFECYCLE_MESSAGE => 21, - TS_UNDEFINED_OP => 22 + TS_RECORD_SET => 1, + TS_RECORD_GET => 2, + TS_PROXY_STATE_GET => 3, + TS_PROXY_STATE_SET => 4, + TS_RECONFIGURE => 5, + TS_RESTART => 6, + TS_BOUNCE => 7, + TS_EVENT_RESOLVE => 8, + TS_EVENT_GET_MLT => 9, + TS_EVENT_ACTIVE => 10, + TS_EVENT_REG_CALLBACK => 11, + TS_EVENT_UNREG_CALLBACK => 12, + TS_EVENT_NOTIFY => 13, + TS_STATS_RESET_NODE => 14, + TS_STORAGE_DEVICE_CMD_OFFLINE => 15, + TS_RECORD_MATCH_GET => 16, + TS_API_PING => 17, + TS_SERVER_BACKTRACE => 18, + TS_RECORD_DESCRIBE_CONFIG => 19, + TS_LIFECYCLE_MESSAGE => 20, + TS_UNDEFINED_OP => 21 }; use constant { diff --git a/mgmt/api/APITestCliRemote.cc b/mgmt/api/APITestCliRemote.cc index 262f187..f2e38b9 100644 --- a/mgmt/api/APITestCliRemote.cc +++ b/mgmt/api/APITestCliRemote.cc @@ -43,7 +43,6 @@ * File operations: * --------------- * read_file: reads hosting.config file - * write_file: write some made-up text to hosting.config file * proxy.config.xxx (a records.config variable): returns value of that record * records: tests get/set/get a record of each different type * (int, float, counter, string) @@ -1355,38 +1354,6 @@ test_read_file() } } -/* ------------------------------------------------------------------------ - * test_write_file - * ------------------------------------------------------------------------ - * writes hosting.config with some garbage text then reads the file and - * prints the new file to stdout - */ -void -test_write_file() -{ - char *f_text = nullptr; - int f_size = -1; - int f_ver = -1; - char new_f_text[] = "blah, blah blah\n I hope this works. please!!! \n"; - int new_f_size = strlen(new_f_text); - - printf("\n"); - if (TSConfigFileWrite(TS_FNAME_HOSTING, new_f_text, new_f_size, -1) != TS_ERR_OKAY) { - printf("[TSConfigFileWrite] FAILED!\n"); - } else { - printf("[TSConfigFileWrite] SUCCESS!\n"); - } - printf("\n"); - - // should free f_text??? - if (TSConfigFileRead(TS_FNAME_HOSTING, &f_text, &f_size, &f_ver) != TS_ERR_OKAY) { - printf("[TSConfigFileRead] FAILED!\n"); - } else { - printf("[TSConfigFileRead]\n\tFile Size=%d, Version=%d\n%s\n", f_size, f_ver, f_text); - TSfree(f_text); - } -} - /*************************************************************************** * TSCfgContext Testing ***************************************************************************/ @@ -1449,216 +1416,6 @@ test_cfg_context_get(char *args) return; } -// -// tests the TSCfgContextMoveEleUp/Down functions (which end up calling -// the new "copy" utility functions in CfgContextUtils.cc -// depending on the file specified, this will move the top rule to the bottom, -// and the second to the last rule to the top -// essentially, the original top and bottom rules switch places!! -// -void -test_cfg_context_move(char *args) -{ - TSCfgContext ctx; - TSFileNameT file; - int i; - TSMgmtError err; - char *filename; - - strtok(args, ":"); - filename = strtok(nullptr, ":"); - fprintf(stderr, "modify file: %s\n", filename); - char *name = TSstrdup(filename); - - // convert file name to TSFileNameT - if (strcmp(name, "cache.config") == 0) { - file = TS_FNAME_CACHE_OBJ; - } else if (strcmp(name, "congestion.config") == 0) { - file = TS_FNAME_CONGESTION; - } else if (strcmp(name, "hosting.config") == 0) { - file = TS_FNAME_HOSTING; - } else if (strcmp(name, "ip_allow.config") == 0) { - file = TS_FNAME_IP_ALLOW; - } else if (strcmp(name, "parent.config") == 0) { - file = TS_FNAME_PARENT_PROXY; - } else if (strcmp(name, "volume.config") == 0) { - file = TS_FNAME_VOLUME; - } else if (strcmp(name, "remap.config") == 0) { - file = TS_FNAME_REMAP; - } else if (strcmp(name, "socks.config") == 0) { - file = TS_FNAME_SOCKS; - } else if (strcmp(name, "storage.config") == 0) { - file = TS_FNAME_STORAGE; - } else if (strcmp(name, "splitdns.config") == 0) { - file = TS_FNAME_SPLIT_DNS; - } else { - TSfree(name); - return; - } - - ctx = TSCfgContextCreate(file); - if (TSCfgContextGet(ctx) != TS_ERR_OKAY) { - printf("ERROR READING FILE\n"); - } - - int count = TSCfgContextGetCount(ctx); - printf("%d rules in file: %s\n", count, name); - - // shift all the ele's up so that the top ele is now the bottom ele - printf("\nShift all ele's up so that top ele is now bottom ele\n"); - for (i = 1; i < count; i++) { - err = TSCfgContextMoveEleUp(ctx, i); - if (err != TS_ERR_OKAY) { - printf("ERROR moving ele at index %d up \n", i); - goto END; - } - } - - // shift all the ele's down so that the next to bottom ele is now top ele - // move all ele's above the last ele down; bottom ele becomes top ele - printf("\nShift all Ele's above second to last ele down; bottom ele becomes top ele\n"); - for (i = count - 3; i >= 0; i--) { - err = TSCfgContextMoveEleDown(ctx, i); - if (err != TS_ERR_OKAY) { - printf("ERROR: moving ele down at index %d\n", i); - goto END; - } - } - - // clean up; commit change - TSCfgContextCommit(ctx, nullptr, nullptr); - -END: - TSCfgContextDestroy(ctx); - TSfree(name); - return; -} - -/* ------------------------------------------------------------------------ - * test_cfg_plugin - * ------------------------------------------------------------------------ - * Gets all the Ele's from plugin.config, modifies them, and commits the changes - * to file - */ -void -test_cfg_plugin() -{ - // Not used here. - // TSCfgIterState iter_state; - TSCfgContext ctx; - TSCfgEle *cfg_ele; - TSPluginEle *ele; - - ctx = TSCfgContextCreate(TS_FNAME_PLUGIN); - if (TSCfgContextGet(ctx) != TS_ERR_OKAY) { - printf("ERROR READING FILE\n"); - } - - // retrieve and modify ele - printf("test_cfg_plugin: modifying the first ele...\n"); - cfg_ele = TSCfgContextGetEleAt(ctx, 0); - ele = (TSPluginEle *)cfg_ele; - if (ele) { - // free(ele->name); - ele->name = ats_strdup("change-plugin.so"); - } - - // remove the second ele - printf("test_cfg_plugin: removing the second ele...\n"); - TSCfgContextRemoveEleAt(ctx, 1); - - // create and add new ele - printf("test_socks_set: appending a new ele...\n"); - ele = TSPluginEleCreate(); - - ele->name = ats_strdup("new-plugin.so"); - - ele->args = TSStringListCreate(); - TSStringListEnqueue(ele->args, ats_strdup("arg1")); - TSStringListEnqueue(ele->args, ats_strdup("arg2")); - TSCfgContextAppendEle(ctx, (TSCfgEle *)ele); - - // commit change - TSCfgContextCommit(ctx, nullptr, nullptr); - - TSCfgContextDestroy(ctx); -} - -/* ------------------------------------------------------------------------ - * test_cfg_socks - * ------------------------------------------------------------------------ - * Gets all the Ele's from socks, modifies them, and commits the changes - * to file - */ -void -test_cfg_socks() -{ - // Not used here. - // TSCfgIterState iter_state; - TSCfgContext ctx; - TSCfgEle *cfg_ele; - TSSocksEle *ele; - - ctx = TSCfgContextCreate(TS_FNAME_SOCKS); - if (TSCfgContextGet(ctx) != TS_ERR_OKAY) { - printf("ERROR READING FILE\n"); - } - - // retrieving an ele - printf("test_socks_set: modifying the fourth ele...\n"); - cfg_ele = TSCfgContextGetEleAt(ctx, 3); - ele = (TSSocksEle *)cfg_ele; - if (ele) { - if (ele->rr != TS_RR_NONE) { - ele->rr = TS_RR_FALSE; - } - } - - // remove the second ele - printf("test_socks_set: removing the second ele...\n"); - TSCfgContextRemoveEleAt(ctx, 1); - - // create new structs for new rules - TSIpAddrEle *ip1 = TSIpAddrEleCreate(); - ip1->type = TS_IP_SINGLE; - ip1->ip_a = TSstrdup("1.1.1.1"); - - TSDomainList dlist = TSDomainListCreate(); - TSDomain *dom1 = TSDomainCreate(); - dom1->domain_val = TSstrdup("www.mucky.com"); - dom1->port = 8888; - TSDomainListEnqueue(dlist, dom1); - - TSDomain *dom2 = TSDomainCreate(); - dom2->domain_val = TSstrdup("freakazoid.com"); - dom2->port = 2222; - TSDomainListEnqueue(dlist, dom2); - - TSDomain *dom3 = TSDomainCreate(); - dom3->domain_val = TSstrdup("hong.kong.com"); - dom3->port = 3333; - TSDomainListEnqueue(dlist, dom3); - - // create and add new ele - printf("test_socks_set: appending a new ele...\n"); - ele = TSSocksEleCreate(TS_TYPE_UNDEFINED); - if (ele) { - ele->cfg_ele.type = TS_SOCKS_MULTIPLE; - ele->dest_ip_addr = ip1; - ele->socks_servers = dlist; - ele->rr = TS_RR_STRICT; - - TSCfgContextAppendEle(ctx, (TSCfgEle *)ele); - } else { - printf("Can't create SocksEle\n"); - } - - // commit change - TSCfgContextCommit(ctx, nullptr, nullptr); - - TSCfgContextDestroy(ctx); -} - /*************************************************************************** * Events Testing ***************************************************************************/ @@ -1965,8 +1722,6 @@ runInteractive() test_record_set_mlt(); } else if (strstr(buf, "read_file")) { test_read_file(); - } else if (strstr(buf, "write_file")) { - test_write_file(); } else if (strstr(buf, "proxy.")) { test_rec_get(buf); } else if (strstr(buf, "active_events")) { @@ -1983,12 +1738,6 @@ runInteractive() test_read_url(false); } else if (strstr(buf, "cfg_get:")) { test_cfg_context_get(buf); - } else if (strstr(buf, "cfg:")) { - test_cfg_context_move(buf); - } else if (strstr(buf, "cfg_socks")) { - test_cfg_socks(); - } else if (strstr(buf, "cfg_plugin")) { - test_cfg_plugin(); } else if (strstr(buf, "reset_stats")) { reset_stats(); } else if (strstr(buf, "set_stats")) { diff --git a/mgmt/api/CfgContextManager.cc b/mgmt/api/CfgContextManager.cc index ec30634..acc1dbb 100644 --- a/mgmt/api/CfgContextManager.cc +++ b/mgmt/api/CfgContextManager.cc @@ -75,77 +75,6 @@ CfgContextDestroy(CfgContext *ctx) } /* --------------------------------------------------------------- - * CfgContextCommit - * --------------------------------------------------------------- - * Convert CfgContext into file, and write the file. - * Return TS_ERR_FAIL if completely fail to commit changes (eg. - * write new file). Returns TS_ERR_INVALID_CONFIG_RULE if succeeded - * in commiting changes, but at least one rule was invalid. - * errRules is an optional argument - if specified, then a - * list of the indices of the invalid rules will be stored in it - */ -TSMgmtError -CfgContextCommit(CfgContext *ctx, LLQ *errRules) -{ - int ret; - char *new_text = nullptr; - char *rule = nullptr; - CfgEleObj *ele; - int ver, size = 0, index; - int *iPtr; - TSMgmtError err = TS_ERR_OKAY; - int max_file_size = MAX_FILE_SIZE; - int len = 0; - - ink_assert(ctx); - if (!ctx) { - return TS_ERR_PARAMS; - } - - new_text = (char *)ats_malloc(max_file_size + 1); - new_text[0] = '\0'; - ele = ctx->first(); - index = 0; - while (ele) { - rule = ele->formatEleToRule(); // use polymorphism - if (!rule) { - err = TS_ERR_INVALID_CONFIG_RULE; - rule = ats_strdup(FORMAT_TO_RULE_ERROR); - if (errRules) { - iPtr = (int *)ats_malloc(sizeof(int)); - *iPtr = index; - enqueue(errRules, (void *)iPtr); - } - } - // write the rule to end of the file - len = strlen(rule); - size += len + 1; - if (size > max_file_size) { - max_file_size *= 2; - new_text = (char *)ats_realloc(new_text, max_file_size + 1); - } - ink_strlcat(new_text, rule, max_file_size + 1); - ink_strlcat(new_text, "\n", max_file_size + 1); - - ats_free(rule); - if (ele->getRuleType() != TS_TYPE_COMMENT) { - index++; - } - ele = ctx->next(ele); - } - - // commit new file - ver = ctx->getVersion(); - ret = WriteFile(ctx->getFilename(), new_text, size, ver); - ats_free(new_text); - if (ret != TS_ERR_OKAY) { - return TS_ERR_FAIL; // couldn't write file - } - - return err; -} - -/* --------------------------------------------------------------- * CfgContextGet * --------------------------------------------------------------- * Read the file, get a copy of it, parse the file, convert the diff --git a/mgmt/api/CfgContextManager.h b/mgmt/api/CfgContextManager.h index 8578af7..b665dc6 100644 --- a/mgmt/api/CfgContextManager.h +++ b/mgmt/api/CfgContextManager.h @@ -48,7 +48,6 @@ */ CfgContext *CfgContextCreate(TSFileNameT filetype); TSMgmtError CfgContextDestroy(CfgContext *ctx); -TSMgmtError CfgContextCommit(CfgContext *ctx, LLQ *errRules = NULL); TSMgmtError CfgContextGet(CfgContext *ctx); /*************************************************************************** diff --git a/mgmt/api/CoreAPI.cc b/mgmt/api/CoreAPI.cc index d3977e0..60c3036 100644 --- a/mgmt/api/CoreAPI.cc +++ b/mgmt/api/CoreAPI.cc @@ -744,66 +744,6 @@ ReadFile(TSFileNameT file, char **text, int *size, int *version) return TS_ERR_OKAY; } -/*------------------------------------------------------------------------- - * WriteFile - *------------------------------------------------------------------------- - * Purpose: replaces the current file with the file passed in; - * does forceUpdate for Rollback and FileManager so correct file - * versioning is maintained - * Input: file - the config file to write - * text - text buffer to write - * size - the size of the buffer to write - * version - the current version level; new file will have the - * version number above this one - */ -TSMgmtError -WriteFile(TSFileNameT file, const char *text, int size, int version) -{ - const char *fname; - Rollback *file_rb; - TextBuffer *file_content; - int ret; - version_t ver; - - fname = filename_to_string(file); - if (!fname) { - return TS_ERR_WRITE_FILE; - } - - // get rollback object for config file - mgmt_log("[CfgFileIO::WriteFile] %s\n", fname); - if (!(configFiles->getRollbackObj(fname, &file_rb))) { - mgmt_log("[CfgFileIO::WriteFile] ERROR getting rollback object\n"); - // goto generate_error_msg; - } - - // if version < 0 then, just use next version in sequence; - // otherwise check if trying to commit an old version - if (version >= 0) { - // check that the current version is equal to or less than the version - // that wants to be written - ver = file_rb->getCurrentVersion(); - if (ver != version) { // trying to commit an old version - return TS_ERR_WRITE_FILE; - } - } - // use rollback object to update file with new content - file_content = new TextBuffer(size + 1); - ret = file_content->copyFrom(text, size); - if (ret < 0) { - delete file_content; - return TS_ERR_WRITE_FILE; - } - - if ((file_rb->forceUpdate(file_content, -1)) != OK_ROLLBACK) { - delete file_content; - return TS_ERR_WRITE_FILE; - } - - delete file_content; - return TS_ERR_OKAY; -} - /************************************************************************** * EVENTS *************************************************************************/ diff --git a/mgmt/api/CoreAPI.h b/mgmt/api/CoreAPI.h index 9b8c45e..9e19b11 100644 --- a/mgmt/api/CoreAPI.h +++ b/mgmt/api/CoreAPI.h @@ -70,7 +70,6 @@ TSMgmtError MgmtConfigRecordDescribeMatching(const char *regex, unsigned flags, * File Operations ***************************************************************************/ TSMgmtError ReadFile(TSFileNameT file, char **text, int *size, int *version); -TSMgmtError WriteFile(TSFileNameT file, const char *text, int size, int version); /*************************************************************************** * Events diff --git a/mgmt/api/CoreAPIRemote.cc b/mgmt/api/CoreAPIRemote.cc index eda26e9..962b02c 100644 --- a/mgmt/api/CoreAPIRemote.cc +++ b/mgmt/api/CoreAPIRemote.cc @@ -871,34 +871,6 @@ ReadFile(TSFileNameT file, char **text, int *size, int *version) return TS_ERR_OKAY; } -/*------------------------------------------------------------------------- - * WriteFile - *------------------------------------------------------------------------- - * Purpose: replaces the current file with the file passed in; - * does forceUpdate for Rollback and FileManager so correct file - * versioning is maintained - * Input: file - the config file to write - * text - text buffer to write - * size - the size of the buffer to write - * - * Marshals a write file request that can be sent over the unix domain socket. - * Connects to the socket and sends request over. Parses the response from - * Traffic Manager. - */ -TSMgmtError -WriteFile(TSFileNameT file, const char *text, int size, int version) -{ - TSMgmtError ret; - - OpType optype = OpType::FILE_WRITE; - MgmtMarshallInt fid = file; - MgmtMarshallInt vers = version; - MgmtMarshallData data = {(void *)text, (size_t)size}; - - ret = MGMTAPI_SEND_MESSAGE(main_socket_fd, OpType::FILE_WRITE, &optype, &fid, &vers, &data); - return (ret == TS_ERR_OKAY) ? parse_generic_response(OpType::FILE_WRITE, main_socket_fd) : ret; -} - /*************************************************************************** * Events ***************************************************************************/ diff --git a/mgmt/api/EventControlMain.cc b/mgmt/api/EventControlMain.cc index 78c6b5a..ccf2bcc 100644 --- a/mgmt/api/EventControlMain.cc +++ b/mgmt/api/EventControlMain.cc @@ -520,7 +520,6 @@ using event_message_handler = TSMgmtError (*)(EventClientT *, void *, size_t); static const event_message_handler handlers[] = { nullptr, // FILE_READ - nullptr, // FILE_WRITE nullptr, // RECORD_SET nullptr, // RECORD_GET nullptr, // PROXY_STATE_GET diff --git a/mgmt/api/INKMgmtAPI.cc b/mgmt/api/INKMgmtAPI.cc index 9016d0d..4703c2a 100644 --- a/mgmt/api/INKMgmtAPI.cc +++ b/mgmt/api/INKMgmtAPI.cc @@ -1755,12 +1755,6 @@ TSConfigFileRead(TSFileNameT file, char **text, int *size, int *version) return ReadFile(file, text, size, version); } -tsapi TSMgmtError -TSConfigFileWrite(TSFileNameT file, char *text, int size, int version) -{ - return WriteFile(file, text, size, version); -} - /* ReadFromUrl: reads a remotely located config file into a buffer * Input: url - remote location of the file * header - a buffer is allocated on the header char* pointer @@ -2143,12 +2137,6 @@ TSCfgContextDestroy(TSCfgContext ctx) } tsapi TSMgmtError -TSCfgContextCommit(TSCfgContext ctx, TSActionNeedT * /* action_need ATS_UNUSED */, TSIntList errRules) -{ - return (CfgContextCommit((CfgContext *)ctx, (LLQ *)errRules)); -} - -tsapi TSMgmtError TSCfgContextGet(TSCfgContext ctx) { return (CfgContextGet((CfgContext *)ctx)); diff --git a/mgmt/api/NetworkMessage.cc b/mgmt/api/NetworkMessage.cc index 033dbdd..808e9ed 100644 --- a/mgmt/api/NetworkMessage.cc +++ b/mgmt/api/NetworkMessage.cc @@ -39,7 +39,6 @@ struct NetCmdOperation { // Requests always begin with a OpType, followed by aditional fields. static const struct NetCmdOperation requests[] = { /* FILE_READ */ {2, {MGMT_MARSHALL_INT, MGMT_MARSHALL_INT}}, - /* FILE_WRITE */ {4, {MGMT_MARSHALL_INT, MGMT_MARSHALL_INT, MGMT_MARSHALL_INT, MGMT_MARSHALL_DATA}}, /* RECORD_SET */ {3, {MGMT_MARSHALL_INT, MGMT_MARSHALL_STRING, MGMT_MARSHALL_STRING}}, /* RECORD_GET */ {2, {MGMT_MARSHALL_INT, MGMT_MARSHALL_STRING}}, /* PROXY_STATE_GET */ {1, {MGMT_MARSHALL_INT}}, @@ -66,7 +65,6 @@ static const struct NetCmdOperation requests[] = { // Responses always begin with a TSMgmtError code, followed by additional fields. static const struct NetCmdOperation responses[] = { /* FILE_READ */ {3, {MGMT_MARSHALL_INT, MGMT_MARSHALL_INT, MGMT_MARSHALL_DATA}}, - /* FILE_WRITE */ {1, {MGMT_MARSHALL_INT}}, /* RECORD_SET */ {2, {MGMT_MARSHALL_INT, MGMT_MARSHALL_INT}}, /* RECORD_GET */ {5, {MGMT_MARSHALL_INT, MGMT_MARSHALL_INT, MGMT_MARSHALL_INT, MGMT_MARSHALL_STRING, MGMT_MARSHALL_DATA}}, @@ -195,7 +193,6 @@ send_mgmt_error(int fd, OpType optype, TSMgmtError error) switch (optype) { case OpType::BOUNCE: case OpType::EVENT_RESOLVE: - case OpType::FILE_WRITE: case OpType::LIFECYCLE_MESSAGE: case OpType::PROXY_STATE_SET: case OpType::RECONFIGURE: diff --git a/mgmt/api/NetworkMessage.h b/mgmt/api/NetworkMessage.h index bbbd0a2..a133882 100644 --- a/mgmt/api/NetworkMessage.h +++ b/mgmt/api/NetworkMessage.h @@ -34,7 +34,6 @@ // the possible operations or msg types sent from remote client to TM enum class OpType : MgmtMarshallInt { FILE_READ, - FILE_WRITE, RECORD_SET, RECORD_GET, PROXY_STATE_GET, diff --git a/mgmt/api/TSControlMain.cc b/mgmt/api/TSControlMain.cc index 4931095..a499ad8 100644 --- a/mgmt/api/TSControlMain.cc +++ b/mgmt/api/TSControlMain.cc @@ -539,41 +539,6 @@ handle_file_read(int fd, void *req, size_t reqlen) } /************************************************************************** - * handle_file_write - * - * purpose: handles request to write a file - * output: SUCC or ERR - * note: None - *************************************************************************/ -static TSMgmtError -handle_file_write(int fd, void *req, size_t reqlen) -{ - MgmtMarshallInt optype; - MgmtMarshallInt fid; - MgmtMarshallInt vers; - MgmtMarshallData data = {nullptr, 0}; - - MgmtMarshallInt err; - - err = recv_mgmt_request(req, reqlen, OpType::FILE_WRITE, &optype, &fid, &vers, &data); - if (err != TS_ERR_OKAY) { - goto done; - } - - if (data.ptr == nullptr) { - err = TS_ERR_PARAMS; - goto done; - } - - // make CoreAPI call on Traffic Manager side - err = WriteFile((TSFileNameT)fid, (const char *)data.ptr, data.len, vers); - -done: - ats_free(data.ptr); - return send_mgmt_response(fd, OpType::FILE_WRITE, &err); -} - -/************************************************************************** * handle_proxy_state_get * * purpose: handles request to get the state of the proxy (TS) @@ -1024,7 +989,6 @@ struct control_message_handler { static const control_message_handler handlers[] = { /* FILE_READ */ {MGMT_API_PRIVILEGED, handle_file_read}, - /* FILE_WRITE */ {MGMT_API_PRIVILEGED, handle_file_write}, /* RECORD_SET */ {MGMT_API_PRIVILEGED, handle_record_set}, /* RECORD_GET */ {0, handle_record_get}, /* PROXY_STATE_GET */ {0, handle_proxy_state_get}, diff --git a/mgmt/api/include/mgmtapi.h b/mgmt/api/include/mgmtapi.h index 263d775..9d60d83 100644 --- a/mgmt/api/include/mgmtapi.h +++ b/mgmt/api/include/mgmtapi.h @@ -856,17 +856,6 @@ char *TSGetErrorMessage(TSMgmtError error_id); */ tsapi TSMgmtError TSConfigFileRead(TSFileNameT file, char **text, int *size, int *version); -/* TSConfigFileWrite: writes a config file into a buffer - * Input: file - the config file to write - * text - text buffer to write - * size - the size of the buffer to write - * version - the current version level; new file will have the - * version number above this one (if version < 0, then - * just uses the next version number in the sequence) - * Output: TSMgmtError - */ -tsapi TSMgmtError TSConfigFileWrite(TSFileNameT file, char *text, int size, int version); - /* TSReadFromUrl: reads a remotely located config file into a buffer * Input: url - remote location of the file * header - a buffer is allocated on the header char* pointer @@ -1050,15 +1039,6 @@ tsapi TSCfgContext TSCfgContextCreate(TSFileNameT file); */ tsapi TSMgmtError TSCfgContextDestroy(TSCfgContext ctx); -/* TSCfgContextCommit: write new file copy based on ele's listed in ctx - * Input: ctx - where all the file's eles are stored - * *action_need - indicates which operation required by user for changes to take effect - * Output: TSMgmtError - * Note: If you do not call TSCfgContextGet before calling TSCfgContextCommit, then - * you could possibly overwrite all the old rules in the config file!! - */ -tsapi TSMgmtError TSCfgContextCommit(TSCfgContext ctx, TSActionNeedT *action_need, TSIntList errRules); - /* TSCfgContextGet: retrieves all the Ele's for the file specified in the ctx and * puts them into ctx; note that the ele's in the TSCfgContext don't * all have to be of the same ele type -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].