{"id":1874,"date":"2025-04-08T09:46:49","date_gmt":"2025-04-08T01:46:49","guid":{"rendered":"https:\/\/www.nanoexpress.com\/?p=1874"},"modified":"2025-04-08T09:46:49","modified_gmt":"2025-04-08T01:46:49","slug":"nanoapi%e9%85%8d%e7%bd%ae%e6%96%87%e4%bb%b6%e8%af%b4%e6%98%8e","status":"publish","type":"post","link":"https:\/\/www.nanoexpress.com\/?p=1874","title":{"rendered":"NanoAPI\u914d\u7f6e\u6587\u4ef6\u8bf4\u660e"},"content":{"rendered":"<p>\u9996\u5148\u4e0b\u8f7dNanoAPI\u5f00\u53d1\u5305\uff0c\u89e3\u538b\u540e\u8fdb\u5165hsnanodemo\u76ee\u5f55\u4e0b\uff0c\u67e5\u770b\u914d\u7f6e\u6587\u4ef6<code>HsApiConfig.ini<\/code>\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-cpp\">[fast]\n###########################################\n####### Network configurations     ########\n###########################################\n\n# whether need to close epoll(), 1 indicates running without epoll()\nTCPBusyMode=0\n\n# Affinity CPU ID for thread to send\/receive TCP trading order, -1 indicates no need to set CPU affinity\nTCPTradingCPUID=-1\n\n# Network card name that support EFVI, generally is Solarfare&#039;s\nEFVINetworkCardName=cardname\n\n# IP address of EFVI\nEFVINetworkIP=127.0.0.1\n\n# Port of EFVI, the user needs to ensure the port is available\nEFVILocalPort=0\n\n###########################################\n####### Account configurations     ########\n###########################################\n\n# Specify the session, valid range is 1-16, and 0 indicate not specify the session\n# only one API instance is allowed to be online in one session. Support 16 sessions online at the same time.\n# session 1-12 : Private flow is pushed according to the session id (private flow is isolated between sessions)\n# session 13-16: Private flow is pushed according to the account (can receive all private flows from all sessions under the account)\nBindSessionID=0\n\n###########################################\n####### Accelerate returns configs ########\n###########################################\n\n# whether to accelerate returns, 1 indicates accelerate returns\n# this feature depends on the Nano server has enableed accelerated returns\nAccelerateReturns=0\n\n# whether to log for accelerate returns, should be turned off during trade\n# 1 indictes turn on the log\nLogForAccelerateReturns=0\n\n###########################################\n####### Misc configurations        ########\n###########################################\n\n# Report regulatory infomation\uff1a0-Test; 1-Official\nJKZXRealPublicKey=1\n\n# Seat optimization\uff1a0-close; 1-open\nOptimalSeats=0\n\n[log]\n###########################################\n####### Log configurations         ########\n###########################################\n# log level\uff1a0 debug; 1 info; 2 warn; 3 error\nlevel=3<\/code><\/pre>\n<blockquote>\n<p>[!info]<br \/>\n\u9664\u4e86Misc configurations\u548cLog configurations\u4e4b\u5916\uff0c\u76ee\u524d\u914d\u7f6e\u6587\u4ef6\u53c2\u6570\u90fd\u6709\u5bf9\u5e94\u7684NanoAPI\u63a5\u53e3\u51fd\u6570\uff0c\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86\u914d\u7f6e\u53c2\u6570\u5e76\u8c03\u7528\u4e86\u5bf9\u5e94\u63a5\u53e3\u51fd\u6570\uff0c\u4ee5\u63a5\u53e3\u51fd\u6570\u7684\u8c03\u7528\u4e3a\u51c6\u3002<\/p>\n<\/blockquote>\n<h2>Network configurations<\/h2>\n<p><code>TCPBusyMode<\/code>\uff1a0 - epoll\u6a21\u5f0f\u7f51\u7edc\u76d1\u542c\uff0c\u4e0d\u4f1a100%\u5360\u7528CPU\uff1b1 - \u5fd9\u7b49\u6a21\u5f0f\uff0c\u4f1a100%\u5360\u7528CPU<br \/>\n<code>TCPTradingCPUID<\/code>\uff1aTCP\u6536\u53d1\u7ebf\u7a0b\u7ed1\u5b9a\u7684CPU\u6838\u5fc3\uff0c-1\u8868\u793a\u4e0d\u6307\u5b9a\u7ed1\u6838<br \/>\n\u53c2\u6570\u5bf9\u5e94\u63a5\u53e3\uff1a<\/p>\n<pre><code class=\"language-cpp\">\/\/\/ Description:\u8bbe\u7f6e\u989d\u5916\u53c2\u6570\uff0c\u5728Init\u63a5\u53e3\u524d\u8c03\u7528\n\/\/\/ bIsBusyMode: tcp\u8fde\u63a5\u6a21\u5f0f\u3002\u9ed8\u8ba4\u975e\u5fd9\u7b49\u6a21\u5f0f\n\/\/\/ nCpuID: tcp\u8fde\u63a5\u7ebf\u7a0b\u7ed1\u6838\u7f16\u53f7\u3002\u9ed8\u8ba4\u4e0d\u6307\u5b9aCPU\u7f16\u53f7\nvirtual void SetParams(bool bIsBusyMode = false, int nCpuID = -1) = 0;<\/code><\/pre>\n<hr \/>\n<p><code>EFVINetworkCardName<\/code>\uff1a\u6307\u5b9aEFVI\u53d1\u9001\u7684\u7f51\u5361\u540d\uff0c\u901a\u5e38\u662fsolarfare\u7f51\u5361<br \/>\n<code>EFVINetworkIP<\/code>\uff1a\u6307\u5b9aEFVI\u53d1\u9001\u7684IP\u5730\u5740<br \/>\n<code>EFVILocalPort<\/code>\uff1a\u6307\u5b9aEFVI\u53d1\u9001\u7684\u7aef\u53e3\u53f7<br \/>\n\u53c2\u6570\u5bf9\u5e94\u63a5\u53e3\uff1a<\/p>\n<pre><code class=\"language-cpp\">\/\/\/ Description:\u8bbe\u7f6eEFVI\u8fde\u63a5\u53c2\u6570\u7528\u4e8e\u540e\u7eedEFVI\u88f8\u534f\u8bae\u62a5\u5355\uff0c\u5728Init\u63a5\u53e3\u524d\u8c03\u7528\uff08\u540e\u7eed\u53ea\u4f7f\u7528\u666e\u901aUDP\u88f8\u534f\u8bae\u65f6\u65e0\u9700\u8c03\u7528\u672c\u63a5\u53e3\uff09\n\/\/\/ pEthName: \u7f51\u5361\u540d\uff08solafare\u4e07\u5146\u7f51\u5361\uff09\n\/\/\/ pLocalIp: \u672c\u5730IP\n\/\/\/ nLocalport: \u672c\u5730\u7aef\u53e3\uff0cEFVI\u7684\u8d77\u59cb\u7aef\u53e3\uff08\u591a\u7ebf\u7a0b\u88f8\u534f\u8bae\u62a5\u5355\u65f6\u4f1a\u5360\u7528\u591a\u4e2a\u7aef\u53e3\uff0c\u5ba2\u6237\u9700\u4fdd\u8bc1\u4f20\u5165\u7aef\u53e3\u6ca1\u6709\u88ab\u5360\u7528\uff09\nvirtual int SetEFVIParams(const char* pEthName, const char* pLocalIp, uint16_t nLocalport) = 0;<\/code><\/pre>\n<h2>Account configurations<\/h2>\n<p><code>BindSessionID<\/code>\uff1a\u8d26\u6237\u672c\u6b21\u767b\u5f55\u7ed1\u5b9a\u7684\u4f1a\u8bdd\u53f7\uff0c\u6709\u6548\u8303\u56f41~16\uff0c\u591a\u4e2aAPI\u5b9e\u4f8b\u4e0d\u80fd\u540c\u65f6\u6307\u5b9a\u76f8\u540c\u7684\u4f1a\u8bdd\u53f7\u3002<br \/>\n\u6307\u5b9a\u4f1a\u8bdd1~12\uff1a\u53ea\u6536\u5230\u8d26\u6237\u4e0b\u6307\u5b9a\u4f1a\u8bdd\u53f7\u62a5\u5355\u7684\u56de\u62a5\u79c1\u6709\u6d41\u3002<br \/>\n\u6307\u5b9a\u4f1a\u8bdd13~16\uff1a\u53ef\u4ee5\u6536\u5230\u8d26\u6237\u4e0b\u6240\u6709\u7684\u56de\u62a5\u79c1\u6709\u6d41\u3002<br \/>\n\u53c2\u6570\u5bf9\u5e94\u63a5\u53e3\uff1a<\/p>\n<pre><code class=\"language-cpp\">\/\/\/ Description: \u7ed1\u5b9a\u4f1a\u8bdd\u7f16\u7801\nvirtual int BindSessionID(const uint8 nSessionID) = 0;<\/code><\/pre>\n<h2>Accelerate returns configs<\/h2>\n<p><code>AccelerateReturns<\/code>\uff1a\u56de\u62a5\u52a0\u901f\u5f00\u5173\u30020 - \u5173\u95ed\uff1b1 - \u5f00\u542f\u3002<br \/>\n<code>LogForAccelerateReturns<\/code>\uff1a\u56de\u62a5\u52a0\u901f\u6d41\u65e5\u5fd7\u5f00\u5173\uff0c\u5b9e\u76d8\u5efa\u8bae\u5173\u95ed\u30020 - \u5173\u95ed\uff1b1 - \u5f00\u542f\u3002<br \/>\n\u53c2\u6570\u5bf9\u5e94\u63a5\u53e3\uff1a<\/p>\n<pre><code class=\"language-cpp\">\/\/\/ Description:\u8bbe\u7f6eFPGA\u53c2\u6570\uff0c\u5728Init\u63a5\u53e3\u524d\u8c03\u7528\n\/\/\/ bFpgaReturn : FPGA\u56de\u62a5\u52a0\u901f\u5f00\u5173\u3002\u8bbe\u7f6etrue\u8868\u793a\u5f00\u542fFPGA\u56de\u62a5\u52a0\u901f\n\/\/\/ nStreamLogCpuID : FPGA\u6d41\u65e5\u5fd7\u5f00\u5173\u3002\u9ed8\u8ba4\u4e0d\u5f00\u542f\u6d41\u65e5\u5fd7\nvirtual void SetFPGAParams(bool bFpgaReturn, bool bStreamLog = false) = 0;<\/code><\/pre>\n<h2>Misc configurations<\/h2>\n<p><code>JKZXRealPublicKey<\/code>\uff1a\u770b\u7a7f\u5f0f\u76d1\u7ba1\u914d\u7f6e\u3002\u9ed8\u8ba4 1 - \u5f00\u542f\u751f\u4ea7\u7248\u770b\u7a7f\u5f0f\uff1b0 - \u5f00\u542f\u6d4b\u8bd5\u7248\u770b\u7a7f\u5f0f\uff0c\u7528\u4e8e\u63a5\u5165\u6d4b\u8bd5\u73af\u5883\u9a8c\u8bc1\u3002<br \/>\n<code>OptimalSeats<\/code>\uff1a\u6682\u4e0d\u652f\u6301\u3002<\/p>\n<h2>Log configurations<\/h2>\n<p><code>level<\/code>\uff1a\u65e5\u5fd7\u7ea7\u522b\u30020 - debug\uff1b1 - info\uff1b2 - warn\uff1b3 - error\uff1b\u9ed8\u8ba4error\u7ea7\u522b<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148\u4e0b\u8f7dNanoAPI\u5f00\u53d1\u5305\uff0c\u89e3\u538b\u540e\u8fdb\u5165hsnanodemo\u76ee\u5f55\u4e0b\uff0c\u67e5\u770b\u914d\u7f6e\u6587\u4ef6HsApiConfig.ini [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-1874","post","type-post","status-publish","format-standard","hentry","category-nanoapi"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/www.nanoexpress.com\/index.php?rest_route=\/wp\/v2\/posts\/1874","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nanoexpress.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nanoexpress.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nanoexpress.com\/index.php?rest_route=\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nanoexpress.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1874"}],"version-history":[{"count":1,"href":"https:\/\/www.nanoexpress.com\/index.php?rest_route=\/wp\/v2\/posts\/1874\/revisions"}],"predecessor-version":[{"id":1875,"href":"https:\/\/www.nanoexpress.com\/index.php?rest_route=\/wp\/v2\/posts\/1874\/revisions\/1875"}],"wp:attachment":[{"href":"https:\/\/www.nanoexpress.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1874"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nanoexpress.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1874"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nanoexpress.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1874"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}