From a428c67e2496d06fcb62ddc379d5a1743c74b77a Mon Sep 17 00:00:00 2001 From: Cyberbolt <735245473@qq.com> Date: Wed, 30 Mar 2022 22:14:12 +0800 Subject: [PATCH] doc update --- README.md | 2 +- README_CHN.md | 2 +- documentation/.DS_Store | Bin 6148 -> 6148 bytes documentation/docs/index.md | 2 +- documentation/site/index.html | 4 ++-- documentation/site/search/search_index.json | 2 +- documentation/site/sitemap.xml.gz | Bin 213 -> 213 bytes documentation_chn/docs/index.md | 2 +- documentation_chn/site/index.html | 4 ++-- .../site/search/search_index.json | 2 +- documentation_chn/site/sitemap.xml.gz | Bin 213 -> 213 bytes 11 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d92510a..2b57ec6 100644 --- a/README.md +++ b/README.md @@ -305,7 +305,7 @@ for v in list1: 99 -It is strongly recommended to use a for loop to iterate CyberDict, each iteration will get v from the server, and the space complexity of the client is o(1). Iteration can also be used for CyberDict. In the iteration of CyberDict, the client space complexity is o(n), and n is the size of CyberDict.keys(). +It is strongly recommended to use a for loop to iterate CyberList, each iteration will get v from the server, and the space complexity of the client is o(1). Iteration can also be used for CyberDict. In the iteration of CyberDict, the client space complexity is o(n), and n is the size of CyberDict.keys(). #### Release the Proxy Object diff --git a/README_CHN.md b/README_CHN.md index 1327c2c..d7254c3 100644 --- a/README_CHN.md +++ b/README_CHN.md @@ -301,7 +301,7 @@ for v in list1: 99 -强烈推荐使用 for 循环迭代 CyberDict,每次迭代将从服务端获取 v,客户端的空间复杂度为 o(1)。迭代同样可用于 CyberDict,CyberDict 的迭代中,客户端空间复杂度为 o(n), n 为 CyberDict.keys() 的长度。 +强烈推荐使用 for 循环迭代 CyberList,每次迭代将从服务端获取 v,客户端的空间复杂度为 o(1)。迭代同样可用于 CyberDict,CyberDict 的迭代中,客户端空间复杂度为 o(n), n 为 CyberDict.keys() 的长度。 #### 释放 proxy 对象 diff --git a/documentation/.DS_Store b/documentation/.DS_Store index 9f888bc3bcba4bfe83b8f4c7cec90a0db1118ca2..0ee4298af92cd5a495a7cccafd14f801c8970f62 100644 GIT binary patch delta 110 zcmZoMXfc@J&&ahgU^g=(*Jd7;U?y93hGK?Hh7yL>V2$6c{(NbNuB80HbCJ@Bjb+ diff --git a/documentation/docs/index.md b/documentation/docs/index.md index d92510a..2b57ec6 100644 --- a/documentation/docs/index.md +++ b/documentation/docs/index.md @@ -305,7 +305,7 @@ for v in list1: 99 -It is strongly recommended to use a for loop to iterate CyberDict, each iteration will get v from the server, and the space complexity of the client is o(1). Iteration can also be used for CyberDict. In the iteration of CyberDict, the client space complexity is o(n), and n is the size of CyberDict.keys(). +It is strongly recommended to use a for loop to iterate CyberList, each iteration will get v from the server, and the space complexity of the client is o(1). Iteration can also be used for CyberDict. In the iteration of CyberDict, the client space complexity is o(n), and n is the size of CyberDict.keys(). #### Release the Proxy Object diff --git a/documentation/site/index.html b/documentation/site/index.html index 47fe4e8..56cf710 100644 --- a/documentation/site/index.html +++ b/documentation/site/index.html @@ -255,7 +255,7 @@
Common Operations of CyberList
100 99 -

It is strongly recommended to use a for loop to iterate CyberDict, each iteration will get v from the server, and the space complexity of the client is o(1). Iteration can also be used for CyberDict. In the iteration of CyberDict, the client space complexity is o(n), and n is the size of CyberDict.keys().

+

It is strongly recommended to use a for loop to iterate CyberList, each iteration will get v from the server, and the space complexity of the client is o(1). Iteration can also be used for CyberDict. In the iteration of CyberDict, the client space complexity is o(n), and n is the size of CyberDict.keys().

Release the Proxy Object

After the use is complete, return the connection of the proxy to the connection pool.

proxy.close()
@@ -351,5 +351,5 @@ 
 
 
diff --git a/documentation/site/search/search_index.json b/documentation/site/search/search_index.json
index a439a6a..040e5a1 100644
--- a/documentation/site/search/search_index.json
+++ b/documentation/site/search/search_index.json
@@ -1 +1 @@
-{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"CyberDB Chinese Version CyberDB is a lightweight Python in-memory database. It is designed to use Python's built-in data structures Dictionaries, Lists for data storage, efficient communication through Socket TCP, and provide data persistence. This module is often used in Gunicorn inter-process communication, distributed computing and other fields. Installation Enter the command window, create a virtual environment, and enter the following commands in turn Linux and macOS: python3 -m venv venv # Create a virtual environment. . venv/bin/activate # Activate the virtual environment. Windows: python -m venv venv # Create a virtual environment. venv\\Scripts\\activate # Activate the virtual environment. 2.Install CyberDB, enter pip install --upgrade pip pip install cyberdb If your server and client are running in two different project directories, please install CyberDB in the virtual environment of the server and client respectively. Links GitHub: https://github.com/Cyberbolt/CyberDB PyPI: https://pypi.org/project/CyberDB/ Documentation: https://www.cyberlight.xyz/static/cyberdb CyberLight: https://www.cyberlight.xyz/ Quick to Use In this module, please use CyberDict and CyberList instead of dict and list (a TCP-based Dictionaries-like, Lists-like object). Server Run the database server. import time import cyberdb db = cyberdb.Server() # The data is persistent, the backup file is data.cdb, and the backup cycle is every 900 seconds. db.set_backup('data.cdb', cycle=900) # Set the TCP address, port number, and password. # The start method will not block the operation. If you want the operation to block, please use the run method instead of start, and the parameters remain unchanged. db.start(host='127.0.0.1', port=9980, password='123456') while True: time.sleep(10000) After the above server runs, data.cdb and data_backup.cdb (backup files) will be generated (or overwritten) in the project root directory every 900 seconds. The file can be read the next time the database is started using the load method. Client Connect to the Database import cyberdb # Generate a client instance and connect. client = cyberdb.connect(host='127.0.0.1', port=9980, password='123456') Generate proxy Object # Generate proxy for this request. proxy = client.get_proxy() # Automatically obtain database connections from the connection pool. proxy.connect() The proxy object is not thread-safe, please generate the proxy object separately in each thread (or coroutine), and obtain the database connection through the connect method. You only need to use the close method to return the connection after the operation is completed, and the returned connection is managed intelligently by the client object. Manipulate proxy Objects Create CyberDict and CyberList # Create dict1 and dict2 tables of type CyberDict and # list1 table of type CyberList in the database respectively. proxy.create_cyberdict('dict1') proxy.create_cyberdict('dict2') proxy.create_cyberlist('list1') dict1 = proxy.get_cyberdict('dict1') dict2 = proxy.get_cyberdict('dict2') list1 = proxy.get_cyberlist('list1') The dict1, dict2, and list1 obtained here are all network objects, and the data is transmitted through TCP. The three objects are controlled by the proxy, and when proxy.close() is called to return the connection, the three objects will also be invalid. Similarly, use proxy.connect() to get connections from the connection pool again, and dict1, dict2, list1 also become available. Once you understand this operation, you can operate dict1, dict2 like Dictionaries, and list1 like Lists! (CyberDict and CyberList support most methods of Dictionaries, Lists) Examples are as follows Common Operations of CyberDict Add key-value pairs in dict1 and dict2 dict1[0] = 100 dict1['test'] = 'Hello CyberDB!' dict2[0] = 200 Get the corresponding value dict1.get(0) 100 dict2[0] 200 View dict1 and dict2 (can also be printed with print ) dict1 {0: 100, 'test': 'Hello CyberDB!'} dict2 {0: 200} Get length len(dict1) 2 Delete key-value pair del dict1[0] dict1 {'test': 'Hello CyberDB!'} Empty dict1 dict1.clear() dict1 {} Common Operations of CyberList Generate the contents of list1 for i in range(5): list1.append(99) list1 [99, 99, 99, 99, 99] Change coordinate values list1[3] = 100 list1 [99, 99, 99, 100, 99] To slice list1[3:] [100, 99] Get the length of list1 len(list1) 5 Print each element of list1 by iterating for v in list1: print(v) 99 99 99 100 99 It is strongly recommended to use a for loop to iterate CyberDict, each iteration will get v from the server, and the space complexity of the client is o(1). Iteration can also be used for CyberDict. In the iteration of CyberDict, the client space complexity is o(n), and n is the size of CyberDict.keys(). Release the Proxy Object After the use is complete, return the connection of the proxy to the connection pool. proxy.close() The proxy object also supports context managers, such as with client.get_proxy() as proxy: list1 = proxy.get_cyberlist('list1') print(list1) [99, 99, 99, 100, 99] Generalize With CyberDB, memory performance can be fully utilized, and different processes (or even different hosts) can communicate through Python's data structures. Thank you! Notice Due to encoding limitations, CyberDB will recognize 0 as None, but it does not affect the calculation, please convert None to 0 in the desired position.","title":"Home"},{"location":"#cyberdb","text":"Chinese Version CyberDB is a lightweight Python in-memory database. It is designed to use Python's built-in data structures Dictionaries, Lists for data storage, efficient communication through Socket TCP, and provide data persistence. This module is often used in Gunicorn inter-process communication, distributed computing and other fields.","title":"CyberDB"},{"location":"#installation","text":"Enter the command window, create a virtual environment, and enter the following commands in turn Linux and macOS: python3 -m venv venv # Create a virtual environment. . venv/bin/activate # Activate the virtual environment. Windows: python -m venv venv # Create a virtual environment. venv\\Scripts\\activate # Activate the virtual environment. 2.Install CyberDB, enter pip install --upgrade pip pip install cyberdb If your server and client are running in two different project directories, please install CyberDB in the virtual environment of the server and client respectively.","title":"Installation"},{"location":"#links","text":"GitHub: https://github.com/Cyberbolt/CyberDB PyPI: https://pypi.org/project/CyberDB/ Documentation: https://www.cyberlight.xyz/static/cyberdb CyberLight: https://www.cyberlight.xyz/","title":"Links"},{"location":"#quick-to-use","text":"In this module, please use CyberDict and CyberList instead of dict and list (a TCP-based Dictionaries-like, Lists-like object).","title":"Quick to Use"},{"location":"#server","text":"Run the database server. import time import cyberdb db = cyberdb.Server() # The data is persistent, the backup file is data.cdb, and the backup cycle is every 900 seconds. db.set_backup('data.cdb', cycle=900) # Set the TCP address, port number, and password. # The start method will not block the operation. If you want the operation to block, please use the run method instead of start, and the parameters remain unchanged. db.start(host='127.0.0.1', port=9980, password='123456') while True: time.sleep(10000) After the above server runs, data.cdb and data_backup.cdb (backup files) will be generated (or overwritten) in the project root directory every 900 seconds. The file can be read the next time the database is started using the load method.","title":"Server"},{"location":"#client","text":"","title":"Client"},{"location":"#connect-to-the-database","text":"import cyberdb # Generate a client instance and connect. client = cyberdb.connect(host='127.0.0.1', port=9980, password='123456')","title":"Connect to the Database"},{"location":"#generate-proxy-object","text":"# Generate proxy for this request. proxy = client.get_proxy() # Automatically obtain database connections from the connection pool. proxy.connect() The proxy object is not thread-safe, please generate the proxy object separately in each thread (or coroutine), and obtain the database connection through the connect method. You only need to use the close method to return the connection after the operation is completed, and the returned connection is managed intelligently by the client object.","title":"Generate proxy Object"},{"location":"#manipulate-proxy-objects","text":"Create CyberDict and CyberList # Create dict1 and dict2 tables of type CyberDict and # list1 table of type CyberList in the database respectively. proxy.create_cyberdict('dict1') proxy.create_cyberdict('dict2') proxy.create_cyberlist('list1') dict1 = proxy.get_cyberdict('dict1') dict2 = proxy.get_cyberdict('dict2') list1 = proxy.get_cyberlist('list1') The dict1, dict2, and list1 obtained here are all network objects, and the data is transmitted through TCP. The three objects are controlled by the proxy, and when proxy.close() is called to return the connection, the three objects will also be invalid. Similarly, use proxy.connect() to get connections from the connection pool again, and dict1, dict2, list1 also become available. Once you understand this operation, you can operate dict1, dict2 like Dictionaries, and list1 like Lists! (CyberDict and CyberList support most methods of Dictionaries, Lists) Examples are as follows","title":"Manipulate proxy Objects"},{"location":"#common-operations-of-cyberdict","text":"Add key-value pairs in dict1 and dict2 dict1[0] = 100 dict1['test'] = 'Hello CyberDB!' dict2[0] = 200 Get the corresponding value dict1.get(0) 100 dict2[0] 200 View dict1 and dict2 (can also be printed with print ) dict1 {0: 100, 'test': 'Hello CyberDB!'} dict2 {0: 200} Get length len(dict1) 2 Delete key-value pair del dict1[0] dict1 {'test': 'Hello CyberDB!'} Empty dict1 dict1.clear() dict1 {}","title":"Common Operations of CyberDict"},{"location":"#common-operations-of-cyberlist","text":"Generate the contents of list1 for i in range(5): list1.append(99) list1 [99, 99, 99, 99, 99] Change coordinate values list1[3] = 100 list1 [99, 99, 99, 100, 99] To slice list1[3:] [100, 99] Get the length of list1 len(list1) 5 Print each element of list1 by iterating for v in list1: print(v) 99 99 99 100 99 It is strongly recommended to use a for loop to iterate CyberDict, each iteration will get v from the server, and the space complexity of the client is o(1). Iteration can also be used for CyberDict. In the iteration of CyberDict, the client space complexity is o(n), and n is the size of CyberDict.keys().","title":"Common Operations of CyberList"},{"location":"#release-the-proxy-object","text":"After the use is complete, return the connection of the proxy to the connection pool. proxy.close() The proxy object also supports context managers, such as with client.get_proxy() as proxy: list1 = proxy.get_cyberlist('list1') print(list1) [99, 99, 99, 100, 99]","title":"Release the Proxy Object"},{"location":"#generalize","text":"With CyberDB, memory performance can be fully utilized, and different processes (or even different hosts) can communicate through Python's data structures. Thank you!","title":"Generalize"},{"location":"#notice","text":"Due to encoding limitations, CyberDB will recognize 0 as None, but it does not affect the calculation, please convert None to 0 in the desired position.","title":"Notice"},{"location":"API/","text":"API This part of the documentation covers all the interfaces of CyberDB. For the parts of CyberDB that depend on external libraries, we document the most important parts here and provide a link to the specification document. cyberdb.Server Class class cyberdb.Server This class is used to create CyberDB server objects. def start(self, host: str = '127.0.0.1', port: int = 9980, password: str = None, max_con: int = 500, timeout: int = 0, print_log: bool = False, encrypt: bool = False): ''' Starts the CyberDB server in the background, which does not block foreground tasks. Parameters: host -- TCP listening host address, such as 127.0.0.1. port \u2013 TCP listening port. password -- TCP communication password, it is recommended to use a combination of English letters and numbers, Up to 32 characters long. max_con -- the maximum number of concurrency. timeout -- The timeout for a single connection, in seconds. print_log -- whether to print the communication log, Fasle does not print it. encrypt -- Whether to encrypt the communication content, Fasle is not encrypted. The encryption algorithm is AES-256 and the key is password. Return Type: None ''' def run(self, host: str = '127.0.0.1', port: int = 9980, password: str = None, max_con: int = 500, timeout: int = 0, print_log: bool = False, encrypt: bool = False): ''' Running the CyberDB server in the foreground blocks foreground tasks. The parameters are the same as the start method. Return Type: None ''' def set_ip_whitelist(self, ips: list): ''' Set the ip whitelist. When CyberDB encrypts communication, only whitelisted ip connections are allowed. This method only works if cyberdb.Server.start(encrypt=True) or cyberdb.Server.run(encrypt=True) are enabled. Parameters: ips -- the type is a list, the format is ['192.168.1.1', '118.123.89.137'] Return Type: None ''' def set_backup(self, file_name: str = 'data.cdb', cycle: int = 900): ''' Set timed backup. After this operation is set, data persistent backup will be performed at the specified period, and the CyberDB database will be saved to the hard disk. parameter: file_name -- the name of the file generated by the backup, the file suffix must be .cdb. cycle -- The cycle of the cyclic backup, in seconds. Return Type: None ''' def save_db(self, file_name: str = 'data.cdb'): ''' Data persistence, save the CyberDB database to the hard disk. parameter: file_name -- the name of the file generated by the backup, the file suffix must be .cdb. Return Type: None ''' def load_db(self, file_name: str = 'data.cdb'): ''' Load a file in .cdb format to load the CyberDB database backed up from the hard disk back into memory. parameter: file_name -- the file name generated by data persistence, the file suffix must be .cdb. Return Type: None ''' cyberdb.connect Function def cyberdb.connect(host: str = '127.0.0.1', port: int = 9980, password: str = None, encrypt: bool = False, time_out: int = None) -> Client: ''' Connect the client to the CyberDB server. Parameters: host -- the connection address, such as 127.0.0.1 port -- connection port password -- connection password encrypt -- Whether to encrypt communication, if the server enables encrypt to be True, it must be True here, and vice versa. time_out -- The timeout for each connection in the connection pool, in seconds. Connections in the connection pool will be discarded after time_out seconds of inactivity, and a new connection will be generated next time. The connection pool will manage the connections automatically, and the developer does not need to pay attention to the details. If this parameter is None, there will be no timeout, and the connection pool will maintain the connection until it expires, after which a new connection will be regenerated. Return Type: Client ''' cyberdb.Client Class class cyberdb.Client The cyberdb.Client object returned by the cyberdb.connect function is used to generate the Proxy object. def get_proxy(self) -> Proxy: ''' Generate a Proxy object. Return Type: None ''' Proxy Class The Proxy object generated by the cyberdb.Client.get_proxy method can operate on the CyberDB database and manage the TCP connections of the CyberDict and CyberList sub-objects generated by the Proxy. After the Proxy object is initialized, it can be used after executing the Proxy.connect method. The Proxy object and its sub-objects will perform remote operations on the server-side CyberDB database. class Proxy def connect(self): ''' Get a TCP connection from the connection pool and bind it to the Proxy object. Return Type: None ''' def close(self): ''' Cancel the TCP connection bound to the Proxy object and return it to the connection pool. It needs to be reset before the next operation. Execute the Proxy.connect method. Return Type: None ''' def create_cyberdict(self, table_name: str, content: dict = {}): ''' Create a CyberDict table. Parameters: table_name \u2013 table name. content -- table content, needs to be a dictionary type, the default is an empty dictionary. Return Type: None ''' def create_cyberlist(self, table_name: str, content: list = []): ''' Create the CyberList table. Parameters: table_name \u2013 table name. content -- table content, it needs to be a list type, the default is an empty list. Return Type: None ''' def get_cyberdict(self, table_name: str) -> CyberDict: ''' Get the CyberDict table. Parameters: table_name \u2013 table name. Return Type: CyberDict, which is a sub-object generated by Proxy, which controls the TCP connection. ''' def get_cyberlist(self, table_name: str) -> CyberList: ''' Get the CyberList table. Parameters: table_name \u2013 table name. Return type: CyberList, which is a sub-object generated by Proxy, which controls the TCP connection. ''' def print_tables(self): ''' Print all tables in the CyberDB database. Return Type: None ''' def delete_table(self, table_name: str): ''' Drop the table_name table in the CyberDB database. Parameters: table_name \u2013 the name of the table to drop. Return Type: None ''' cyberdb.CyberDict Class class cyberdb.CyberDict A child object generated by a Proxy object for performing Dictionaries operations. This object will perform remote operations on the server-side CyberDB database. Shares the same TCP connection with the Proxy object. The connection will follow the connection of the Proxy. After the Proxy releases the connection, the object will also lose the connection. CyberDict can execute the get, setdefault, update, keys, values, items, pop, popitem, clear methods and common magic methods of Dictionaries, please refer to Python dictionary official documentation . Iterate over CyberDict using a for loop with client space complexity o(n), where n is the length of CyberDict.keys() . def todict(self) -> Dict: ''' Convert CyberDict to Dictionaries. Return Type: Dict ''' cyberdb.CyberList \u7c7b class cyberdb.CyberList A child object generated by a Proxy object for performing Lists operations. This object will perform remote operations on the server-side CyberDB database. Shares the same TCP connection with the Proxy object. The connection will follow the connection of the Proxy. After the Proxy releases the connection, the object will also lose the connection. CyberList can execute the append, extend, insert, pop, remove, count, index, reverse, sort, clear methods and common magic methods of Lists, please refer to Python List Official Documentation . The CyberList is iterated using a for loop, each iteration will fetch the content from the server, and the space complexity of the client is o(1). def tolist(self) -> List: ''' Convert CyberList to Lists. Return Type: List '''","title":"API"},{"location":"API/#api","text":"This part of the documentation covers all the interfaces of CyberDB. For the parts of CyberDB that depend on external libraries, we document the most important parts here and provide a link to the specification document.","title":"API"},{"location":"API/#cyberdbserver-class","text":"class cyberdb.Server This class is used to create CyberDB server objects. def start(self, host: str = '127.0.0.1', port: int = 9980, password: str = None, max_con: int = 500, timeout: int = 0, print_log: bool = False, encrypt: bool = False): ''' Starts the CyberDB server in the background, which does not block foreground tasks. Parameters: host -- TCP listening host address, such as 127.0.0.1. port \u2013 TCP listening port. password -- TCP communication password, it is recommended to use a combination of English letters and numbers, Up to 32 characters long. max_con -- the maximum number of concurrency. timeout -- The timeout for a single connection, in seconds. print_log -- whether to print the communication log, Fasle does not print it. encrypt -- Whether to encrypt the communication content, Fasle is not encrypted. The encryption algorithm is AES-256 and the key is password. Return Type: None ''' def run(self, host: str = '127.0.0.1', port: int = 9980, password: str = None, max_con: int = 500, timeout: int = 0, print_log: bool = False, encrypt: bool = False): ''' Running the CyberDB server in the foreground blocks foreground tasks. The parameters are the same as the start method. Return Type: None ''' def set_ip_whitelist(self, ips: list): ''' Set the ip whitelist. When CyberDB encrypts communication, only whitelisted ip connections are allowed. This method only works if cyberdb.Server.start(encrypt=True) or cyberdb.Server.run(encrypt=True) are enabled. Parameters: ips -- the type is a list, the format is ['192.168.1.1', '118.123.89.137'] Return Type: None ''' def set_backup(self, file_name: str = 'data.cdb', cycle: int = 900): ''' Set timed backup. After this operation is set, data persistent backup will be performed at the specified period, and the CyberDB database will be saved to the hard disk. parameter: file_name -- the name of the file generated by the backup, the file suffix must be .cdb. cycle -- The cycle of the cyclic backup, in seconds. Return Type: None ''' def save_db(self, file_name: str = 'data.cdb'): ''' Data persistence, save the CyberDB database to the hard disk. parameter: file_name -- the name of the file generated by the backup, the file suffix must be .cdb. Return Type: None ''' def load_db(self, file_name: str = 'data.cdb'): ''' Load a file in .cdb format to load the CyberDB database backed up from the hard disk back into memory. parameter: file_name -- the file name generated by data persistence, the file suffix must be .cdb. Return Type: None '''","title":"cyberdb.Server Class"},{"location":"API/#cyberdbconnect-function","text":"def cyberdb.connect(host: str = '127.0.0.1', port: int = 9980, password: str = None, encrypt: bool = False, time_out: int = None) -> Client: ''' Connect the client to the CyberDB server. Parameters: host -- the connection address, such as 127.0.0.1 port -- connection port password -- connection password encrypt -- Whether to encrypt communication, if the server enables encrypt to be True, it must be True here, and vice versa. time_out -- The timeout for each connection in the connection pool, in seconds. Connections in the connection pool will be discarded after time_out seconds of inactivity, and a new connection will be generated next time. The connection pool will manage the connections automatically, and the developer does not need to pay attention to the details. If this parameter is None, there will be no timeout, and the connection pool will maintain the connection until it expires, after which a new connection will be regenerated. Return Type: Client '''","title":"cyberdb.connect Function"},{"location":"API/#cyberdbclient-class","text":"class cyberdb.Client The cyberdb.Client object returned by the cyberdb.connect function is used to generate the Proxy object. def get_proxy(self) -> Proxy: ''' Generate a Proxy object. Return Type: None '''","title":"cyberdb.Client Class"},{"location":"API/#proxy-class","text":"The Proxy object generated by the cyberdb.Client.get_proxy method can operate on the CyberDB database and manage the TCP connections of the CyberDict and CyberList sub-objects generated by the Proxy. After the Proxy object is initialized, it can be used after executing the Proxy.connect method. The Proxy object and its sub-objects will perform remote operations on the server-side CyberDB database. class Proxy def connect(self): ''' Get a TCP connection from the connection pool and bind it to the Proxy object. Return Type: None ''' def close(self): ''' Cancel the TCP connection bound to the Proxy object and return it to the connection pool. It needs to be reset before the next operation. Execute the Proxy.connect method. Return Type: None ''' def create_cyberdict(self, table_name: str, content: dict = {}): ''' Create a CyberDict table. Parameters: table_name \u2013 table name. content -- table content, needs to be a dictionary type, the default is an empty dictionary. Return Type: None ''' def create_cyberlist(self, table_name: str, content: list = []): ''' Create the CyberList table. Parameters: table_name \u2013 table name. content -- table content, it needs to be a list type, the default is an empty list. Return Type: None ''' def get_cyberdict(self, table_name: str) -> CyberDict: ''' Get the CyberDict table. Parameters: table_name \u2013 table name. Return Type: CyberDict, which is a sub-object generated by Proxy, which controls the TCP connection. ''' def get_cyberlist(self, table_name: str) -> CyberList: ''' Get the CyberList table. Parameters: table_name \u2013 table name. Return type: CyberList, which is a sub-object generated by Proxy, which controls the TCP connection. ''' def print_tables(self): ''' Print all tables in the CyberDB database. Return Type: None ''' def delete_table(self, table_name: str): ''' Drop the table_name table in the CyberDB database. Parameters: table_name \u2013 the name of the table to drop. Return Type: None '''","title":"Proxy Class"},{"location":"API/#cyberdbcyberdict-class","text":"class cyberdb.CyberDict A child object generated by a Proxy object for performing Dictionaries operations. This object will perform remote operations on the server-side CyberDB database. Shares the same TCP connection with the Proxy object. The connection will follow the connection of the Proxy. After the Proxy releases the connection, the object will also lose the connection. CyberDict can execute the get, setdefault, update, keys, values, items, pop, popitem, clear methods and common magic methods of Dictionaries, please refer to Python dictionary official documentation . Iterate over CyberDict using a for loop with client space complexity o(n), where n is the length of CyberDict.keys() . def todict(self) -> Dict: ''' Convert CyberDict to Dictionaries. Return Type: Dict '''","title":"cyberdb.CyberDict Class"},{"location":"API/#cyberdbcyberlist","text":"class cyberdb.CyberList A child object generated by a Proxy object for performing Lists operations. This object will perform remote operations on the server-side CyberDB database. Shares the same TCP connection with the Proxy object. The connection will follow the connection of the Proxy. After the Proxy releases the connection, the object will also lose the connection. CyberList can execute the append, extend, insert, pop, remove, count, index, reverse, sort, clear methods and common magic methods of Lists, please refer to Python List Official Documentation . The CyberList is iterated using a for loop, each iteration will fetch the content from the server, and the space complexity of the client is o(1). def tolist(self) -> List: ''' Convert CyberList to Lists. Return Type: List '''","title":"cyberdb.CyberList \u7c7b"}]}
\ No newline at end of file
+{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"CyberDB Chinese Version CyberDB is a lightweight Python in-memory database. It is designed to use Python's built-in data structures Dictionaries, Lists for data storage, efficient communication through Socket TCP, and provide data persistence. This module is often used in Gunicorn inter-process communication, distributed computing and other fields. Installation Enter the command window, create a virtual environment, and enter the following commands in turn Linux and macOS: python3 -m venv venv # Create a virtual environment. . venv/bin/activate # Activate the virtual environment. Windows: python -m venv venv # Create a virtual environment. venv\\Scripts\\activate # Activate the virtual environment. 2.Install CyberDB, enter pip install --upgrade pip pip install cyberdb If your server and client are running in two different project directories, please install CyberDB in the virtual environment of the server and client respectively. Links GitHub: https://github.com/Cyberbolt/CyberDB PyPI: https://pypi.org/project/CyberDB/ Documentation: https://www.cyberlight.xyz/static/cyberdb CyberLight: https://www.cyberlight.xyz/ Quick to Use In this module, please use CyberDict and CyberList instead of dict and list (a TCP-based Dictionaries-like, Lists-like object). Server Run the database server. import time import cyberdb db = cyberdb.Server() # The data is persistent, the backup file is data.cdb, and the backup cycle is every 900 seconds. db.set_backup('data.cdb', cycle=900) # Set the TCP address, port number, and password. # The start method will not block the operation. If you want the operation to block, please use the run method instead of start, and the parameters remain unchanged. db.start(host='127.0.0.1', port=9980, password='123456') while True: time.sleep(10000) After the above server runs, data.cdb and data_backup.cdb (backup files) will be generated (or overwritten) in the project root directory every 900 seconds. The file can be read the next time the database is started using the load method. Client Connect to the Database import cyberdb # Generate a client instance and connect. client = cyberdb.connect(host='127.0.0.1', port=9980, password='123456') Generate proxy Object # Generate proxy for this request. proxy = client.get_proxy() # Automatically obtain database connections from the connection pool. proxy.connect() The proxy object is not thread-safe, please generate the proxy object separately in each thread (or coroutine), and obtain the database connection through the connect method. You only need to use the close method to return the connection after the operation is completed, and the returned connection is managed intelligently by the client object. Manipulate proxy Objects Create CyberDict and CyberList # Create dict1 and dict2 tables of type CyberDict and # list1 table of type CyberList in the database respectively. proxy.create_cyberdict('dict1') proxy.create_cyberdict('dict2') proxy.create_cyberlist('list1') dict1 = proxy.get_cyberdict('dict1') dict2 = proxy.get_cyberdict('dict2') list1 = proxy.get_cyberlist('list1') The dict1, dict2, and list1 obtained here are all network objects, and the data is transmitted through TCP. The three objects are controlled by the proxy, and when proxy.close() is called to return the connection, the three objects will also be invalid. Similarly, use proxy.connect() to get connections from the connection pool again, and dict1, dict2, list1 also become available. Once you understand this operation, you can operate dict1, dict2 like Dictionaries, and list1 like Lists! (CyberDict and CyberList support most methods of Dictionaries, Lists) Examples are as follows Common Operations of CyberDict Add key-value pairs in dict1 and dict2 dict1[0] = 100 dict1['test'] = 'Hello CyberDB!' dict2[0] = 200 Get the corresponding value dict1.get(0) 100 dict2[0] 200 View dict1 and dict2 (can also be printed with print ) dict1 {0: 100, 'test': 'Hello CyberDB!'} dict2 {0: 200} Get length len(dict1) 2 Delete key-value pair del dict1[0] dict1 {'test': 'Hello CyberDB!'} Empty dict1 dict1.clear() dict1 {} Common Operations of CyberList Generate the contents of list1 for i in range(5): list1.append(99) list1 [99, 99, 99, 99, 99] Change coordinate values list1[3] = 100 list1 [99, 99, 99, 100, 99] To slice list1[3:] [100, 99] Get the length of list1 len(list1) 5 Print each element of list1 by iterating for v in list1: print(v) 99 99 99 100 99 It is strongly recommended to use a for loop to iterate CyberList, each iteration will get v from the server, and the space complexity of the client is o(1). Iteration can also be used for CyberDict. In the iteration of CyberDict, the client space complexity is o(n), and n is the size of CyberDict.keys(). Release the Proxy Object After the use is complete, return the connection of the proxy to the connection pool. proxy.close() The proxy object also supports context managers, such as with client.get_proxy() as proxy: list1 = proxy.get_cyberlist('list1') print(list1) [99, 99, 99, 100, 99] Generalize With CyberDB, memory performance can be fully utilized, and different processes (or even different hosts) can communicate through Python's data structures. Thank you! Notice Due to encoding limitations, CyberDB will recognize 0 as None, but it does not affect the calculation, please convert None to 0 in the desired position.","title":"Home"},{"location":"#cyberdb","text":"Chinese Version CyberDB is a lightweight Python in-memory database. It is designed to use Python's built-in data structures Dictionaries, Lists for data storage, efficient communication through Socket TCP, and provide data persistence. This module is often used in Gunicorn inter-process communication, distributed computing and other fields.","title":"CyberDB"},{"location":"#installation","text":"Enter the command window, create a virtual environment, and enter the following commands in turn Linux and macOS: python3 -m venv venv # Create a virtual environment. . venv/bin/activate # Activate the virtual environment. Windows: python -m venv venv # Create a virtual environment. venv\\Scripts\\activate # Activate the virtual environment. 2.Install CyberDB, enter pip install --upgrade pip pip install cyberdb If your server and client are running in two different project directories, please install CyberDB in the virtual environment of the server and client respectively.","title":"Installation"},{"location":"#links","text":"GitHub: https://github.com/Cyberbolt/CyberDB PyPI: https://pypi.org/project/CyberDB/ Documentation: https://www.cyberlight.xyz/static/cyberdb CyberLight: https://www.cyberlight.xyz/","title":"Links"},{"location":"#quick-to-use","text":"In this module, please use CyberDict and CyberList instead of dict and list (a TCP-based Dictionaries-like, Lists-like object).","title":"Quick to Use"},{"location":"#server","text":"Run the database server. import time import cyberdb db = cyberdb.Server() # The data is persistent, the backup file is data.cdb, and the backup cycle is every 900 seconds. db.set_backup('data.cdb', cycle=900) # Set the TCP address, port number, and password. # The start method will not block the operation. If you want the operation to block, please use the run method instead of start, and the parameters remain unchanged. db.start(host='127.0.0.1', port=9980, password='123456') while True: time.sleep(10000) After the above server runs, data.cdb and data_backup.cdb (backup files) will be generated (or overwritten) in the project root directory every 900 seconds. The file can be read the next time the database is started using the load method.","title":"Server"},{"location":"#client","text":"","title":"Client"},{"location":"#connect-to-the-database","text":"import cyberdb # Generate a client instance and connect. client = cyberdb.connect(host='127.0.0.1', port=9980, password='123456')","title":"Connect to the Database"},{"location":"#generate-proxy-object","text":"# Generate proxy for this request. proxy = client.get_proxy() # Automatically obtain database connections from the connection pool. proxy.connect() The proxy object is not thread-safe, please generate the proxy object separately in each thread (or coroutine), and obtain the database connection through the connect method. You only need to use the close method to return the connection after the operation is completed, and the returned connection is managed intelligently by the client object.","title":"Generate proxy Object"},{"location":"#manipulate-proxy-objects","text":"Create CyberDict and CyberList # Create dict1 and dict2 tables of type CyberDict and # list1 table of type CyberList in the database respectively. proxy.create_cyberdict('dict1') proxy.create_cyberdict('dict2') proxy.create_cyberlist('list1') dict1 = proxy.get_cyberdict('dict1') dict2 = proxy.get_cyberdict('dict2') list1 = proxy.get_cyberlist('list1') The dict1, dict2, and list1 obtained here are all network objects, and the data is transmitted through TCP. The three objects are controlled by the proxy, and when proxy.close() is called to return the connection, the three objects will also be invalid. Similarly, use proxy.connect() to get connections from the connection pool again, and dict1, dict2, list1 also become available. Once you understand this operation, you can operate dict1, dict2 like Dictionaries, and list1 like Lists! (CyberDict and CyberList support most methods of Dictionaries, Lists) Examples are as follows","title":"Manipulate proxy Objects"},{"location":"#common-operations-of-cyberdict","text":"Add key-value pairs in dict1 and dict2 dict1[0] = 100 dict1['test'] = 'Hello CyberDB!' dict2[0] = 200 Get the corresponding value dict1.get(0) 100 dict2[0] 200 View dict1 and dict2 (can also be printed with print ) dict1 {0: 100, 'test': 'Hello CyberDB!'} dict2 {0: 200} Get length len(dict1) 2 Delete key-value pair del dict1[0] dict1 {'test': 'Hello CyberDB!'} Empty dict1 dict1.clear() dict1 {}","title":"Common Operations of CyberDict"},{"location":"#common-operations-of-cyberlist","text":"Generate the contents of list1 for i in range(5): list1.append(99) list1 [99, 99, 99, 99, 99] Change coordinate values list1[3] = 100 list1 [99, 99, 99, 100, 99] To slice list1[3:] [100, 99] Get the length of list1 len(list1) 5 Print each element of list1 by iterating for v in list1: print(v) 99 99 99 100 99 It is strongly recommended to use a for loop to iterate CyberList, each iteration will get v from the server, and the space complexity of the client is o(1). Iteration can also be used for CyberDict. In the iteration of CyberDict, the client space complexity is o(n), and n is the size of CyberDict.keys().","title":"Common Operations of CyberList"},{"location":"#release-the-proxy-object","text":"After the use is complete, return the connection of the proxy to the connection pool. proxy.close() The proxy object also supports context managers, such as with client.get_proxy() as proxy: list1 = proxy.get_cyberlist('list1') print(list1) [99, 99, 99, 100, 99]","title":"Release the Proxy Object"},{"location":"#generalize","text":"With CyberDB, memory performance can be fully utilized, and different processes (or even different hosts) can communicate through Python's data structures. Thank you!","title":"Generalize"},{"location":"#notice","text":"Due to encoding limitations, CyberDB will recognize 0 as None, but it does not affect the calculation, please convert None to 0 in the desired position.","title":"Notice"},{"location":"API/","text":"API This part of the documentation covers all the interfaces of CyberDB. For the parts of CyberDB that depend on external libraries, we document the most important parts here and provide a link to the specification document. cyberdb.Server Class class cyberdb.Server This class is used to create CyberDB server objects. def start(self, host: str = '127.0.0.1', port: int = 9980, password: str = None, max_con: int = 500, timeout: int = 0, print_log: bool = False, encrypt: bool = False): ''' Starts the CyberDB server in the background, which does not block foreground tasks. Parameters: host -- TCP listening host address, such as 127.0.0.1. port \u2013 TCP listening port. password -- TCP communication password, it is recommended to use a combination of English letters and numbers, Up to 32 characters long. max_con -- the maximum number of concurrency. timeout -- The timeout for a single connection, in seconds. print_log -- whether to print the communication log, Fasle does not print it. encrypt -- Whether to encrypt the communication content, Fasle is not encrypted. The encryption algorithm is AES-256 and the key is password. Return Type: None ''' def run(self, host: str = '127.0.0.1', port: int = 9980, password: str = None, max_con: int = 500, timeout: int = 0, print_log: bool = False, encrypt: bool = False): ''' Running the CyberDB server in the foreground blocks foreground tasks. The parameters are the same as the start method. Return Type: None ''' def set_ip_whitelist(self, ips: list): ''' Set the ip whitelist. When CyberDB encrypts communication, only whitelisted ip connections are allowed. This method only works if cyberdb.Server.start(encrypt=True) or cyberdb.Server.run(encrypt=True) are enabled. Parameters: ips -- the type is a list, the format is ['192.168.1.1', '118.123.89.137'] Return Type: None ''' def set_backup(self, file_name: str = 'data.cdb', cycle: int = 900): ''' Set timed backup. After this operation is set, data persistent backup will be performed at the specified period, and the CyberDB database will be saved to the hard disk. parameter: file_name -- the name of the file generated by the backup, the file suffix must be .cdb. cycle -- The cycle of the cyclic backup, in seconds. Return Type: None ''' def save_db(self, file_name: str = 'data.cdb'): ''' Data persistence, save the CyberDB database to the hard disk. parameter: file_name -- the name of the file generated by the backup, the file suffix must be .cdb. Return Type: None ''' def load_db(self, file_name: str = 'data.cdb'): ''' Load a file in .cdb format to load the CyberDB database backed up from the hard disk back into memory. parameter: file_name -- the file name generated by data persistence, the file suffix must be .cdb. Return Type: None ''' cyberdb.connect Function def cyberdb.connect(host: str = '127.0.0.1', port: int = 9980, password: str = None, encrypt: bool = False, time_out: int = None) -> Client: ''' Connect the client to the CyberDB server. Parameters: host -- the connection address, such as 127.0.0.1 port -- connection port password -- connection password encrypt -- Whether to encrypt communication, if the server enables encrypt to be True, it must be True here, and vice versa. time_out -- The timeout for each connection in the connection pool, in seconds. Connections in the connection pool will be discarded after time_out seconds of inactivity, and a new connection will be generated next time. The connection pool will manage the connections automatically, and the developer does not need to pay attention to the details. If this parameter is None, there will be no timeout, and the connection pool will maintain the connection until it expires, after which a new connection will be regenerated. Return Type: Client ''' cyberdb.Client Class class cyberdb.Client The cyberdb.Client object returned by the cyberdb.connect function is used to generate the Proxy object. def get_proxy(self) -> Proxy: ''' Generate a Proxy object. Return Type: None ''' Proxy Class The Proxy object generated by the cyberdb.Client.get_proxy method can operate on the CyberDB database and manage the TCP connections of the CyberDict and CyberList sub-objects generated by the Proxy. After the Proxy object is initialized, it can be used after executing the Proxy.connect method. The Proxy object and its sub-objects will perform remote operations on the server-side CyberDB database. class Proxy def connect(self): ''' Get a TCP connection from the connection pool and bind it to the Proxy object. Return Type: None ''' def close(self): ''' Cancel the TCP connection bound to the Proxy object and return it to the connection pool. It needs to be reset before the next operation. Execute the Proxy.connect method. Return Type: None ''' def create_cyberdict(self, table_name: str, content: dict = {}): ''' Create a CyberDict table. Parameters: table_name \u2013 table name. content -- table content, needs to be a dictionary type, the default is an empty dictionary. Return Type: None ''' def create_cyberlist(self, table_name: str, content: list = []): ''' Create the CyberList table. Parameters: table_name \u2013 table name. content -- table content, it needs to be a list type, the default is an empty list. Return Type: None ''' def get_cyberdict(self, table_name: str) -> CyberDict: ''' Get the CyberDict table. Parameters: table_name \u2013 table name. Return Type: CyberDict, which is a sub-object generated by Proxy, which controls the TCP connection. ''' def get_cyberlist(self, table_name: str) -> CyberList: ''' Get the CyberList table. Parameters: table_name \u2013 table name. Return type: CyberList, which is a sub-object generated by Proxy, which controls the TCP connection. ''' def print_tables(self): ''' Print all tables in the CyberDB database. Return Type: None ''' def delete_table(self, table_name: str): ''' Drop the table_name table in the CyberDB database. Parameters: table_name \u2013 the name of the table to drop. Return Type: None ''' cyberdb.CyberDict Class class cyberdb.CyberDict A child object generated by a Proxy object for performing Dictionaries operations. This object will perform remote operations on the server-side CyberDB database. Shares the same TCP connection with the Proxy object. The connection will follow the connection of the Proxy. After the Proxy releases the connection, the object will also lose the connection. CyberDict can execute the get, setdefault, update, keys, values, items, pop, popitem, clear methods and common magic methods of Dictionaries, please refer to Python dictionary official documentation . Iterate over CyberDict using a for loop with client space complexity o(n), where n is the length of CyberDict.keys() . def todict(self) -> Dict: ''' Convert CyberDict to Dictionaries. Return Type: Dict ''' cyberdb.CyberList \u7c7b class cyberdb.CyberList A child object generated by a Proxy object for performing Lists operations. This object will perform remote operations on the server-side CyberDB database. Shares the same TCP connection with the Proxy object. The connection will follow the connection of the Proxy. After the Proxy releases the connection, the object will also lose the connection. CyberList can execute the append, extend, insert, pop, remove, count, index, reverse, sort, clear methods and common magic methods of Lists, please refer to Python List Official Documentation . The CyberList is iterated using a for loop, each iteration will fetch the content from the server, and the space complexity of the client is o(1). def tolist(self) -> List: ''' Convert CyberList to Lists. Return Type: List '''","title":"API"},{"location":"API/#api","text":"This part of the documentation covers all the interfaces of CyberDB. For the parts of CyberDB that depend on external libraries, we document the most important parts here and provide a link to the specification document.","title":"API"},{"location":"API/#cyberdbserver-class","text":"class cyberdb.Server This class is used to create CyberDB server objects. def start(self, host: str = '127.0.0.1', port: int = 9980, password: str = None, max_con: int = 500, timeout: int = 0, print_log: bool = False, encrypt: bool = False): ''' Starts the CyberDB server in the background, which does not block foreground tasks. Parameters: host -- TCP listening host address, such as 127.0.0.1. port \u2013 TCP listening port. password -- TCP communication password, it is recommended to use a combination of English letters and numbers, Up to 32 characters long. max_con -- the maximum number of concurrency. timeout -- The timeout for a single connection, in seconds. print_log -- whether to print the communication log, Fasle does not print it. encrypt -- Whether to encrypt the communication content, Fasle is not encrypted. The encryption algorithm is AES-256 and the key is password. Return Type: None ''' def run(self, host: str = '127.0.0.1', port: int = 9980, password: str = None, max_con: int = 500, timeout: int = 0, print_log: bool = False, encrypt: bool = False): ''' Running the CyberDB server in the foreground blocks foreground tasks. The parameters are the same as the start method. Return Type: None ''' def set_ip_whitelist(self, ips: list): ''' Set the ip whitelist. When CyberDB encrypts communication, only whitelisted ip connections are allowed. This method only works if cyberdb.Server.start(encrypt=True) or cyberdb.Server.run(encrypt=True) are enabled. Parameters: ips -- the type is a list, the format is ['192.168.1.1', '118.123.89.137'] Return Type: None ''' def set_backup(self, file_name: str = 'data.cdb', cycle: int = 900): ''' Set timed backup. After this operation is set, data persistent backup will be performed at the specified period, and the CyberDB database will be saved to the hard disk. parameter: file_name -- the name of the file generated by the backup, the file suffix must be .cdb. cycle -- The cycle of the cyclic backup, in seconds. Return Type: None ''' def save_db(self, file_name: str = 'data.cdb'): ''' Data persistence, save the CyberDB database to the hard disk. parameter: file_name -- the name of the file generated by the backup, the file suffix must be .cdb. Return Type: None ''' def load_db(self, file_name: str = 'data.cdb'): ''' Load a file in .cdb format to load the CyberDB database backed up from the hard disk back into memory. parameter: file_name -- the file name generated by data persistence, the file suffix must be .cdb. Return Type: None '''","title":"cyberdb.Server Class"},{"location":"API/#cyberdbconnect-function","text":"def cyberdb.connect(host: str = '127.0.0.1', port: int = 9980, password: str = None, encrypt: bool = False, time_out: int = None) -> Client: ''' Connect the client to the CyberDB server. Parameters: host -- the connection address, such as 127.0.0.1 port -- connection port password -- connection password encrypt -- Whether to encrypt communication, if the server enables encrypt to be True, it must be True here, and vice versa. time_out -- The timeout for each connection in the connection pool, in seconds. Connections in the connection pool will be discarded after time_out seconds of inactivity, and a new connection will be generated next time. The connection pool will manage the connections automatically, and the developer does not need to pay attention to the details. If this parameter is None, there will be no timeout, and the connection pool will maintain the connection until it expires, after which a new connection will be regenerated. Return Type: Client '''","title":"cyberdb.connect Function"},{"location":"API/#cyberdbclient-class","text":"class cyberdb.Client The cyberdb.Client object returned by the cyberdb.connect function is used to generate the Proxy object. def get_proxy(self) -> Proxy: ''' Generate a Proxy object. Return Type: None '''","title":"cyberdb.Client Class"},{"location":"API/#proxy-class","text":"The Proxy object generated by the cyberdb.Client.get_proxy method can operate on the CyberDB database and manage the TCP connections of the CyberDict and CyberList sub-objects generated by the Proxy. After the Proxy object is initialized, it can be used after executing the Proxy.connect method. The Proxy object and its sub-objects will perform remote operations on the server-side CyberDB database. class Proxy def connect(self): ''' Get a TCP connection from the connection pool and bind it to the Proxy object. Return Type: None ''' def close(self): ''' Cancel the TCP connection bound to the Proxy object and return it to the connection pool. It needs to be reset before the next operation. Execute the Proxy.connect method. Return Type: None ''' def create_cyberdict(self, table_name: str, content: dict = {}): ''' Create a CyberDict table. Parameters: table_name \u2013 table name. content -- table content, needs to be a dictionary type, the default is an empty dictionary. Return Type: None ''' def create_cyberlist(self, table_name: str, content: list = []): ''' Create the CyberList table. Parameters: table_name \u2013 table name. content -- table content, it needs to be a list type, the default is an empty list. Return Type: None ''' def get_cyberdict(self, table_name: str) -> CyberDict: ''' Get the CyberDict table. Parameters: table_name \u2013 table name. Return Type: CyberDict, which is a sub-object generated by Proxy, which controls the TCP connection. ''' def get_cyberlist(self, table_name: str) -> CyberList: ''' Get the CyberList table. Parameters: table_name \u2013 table name. Return type: CyberList, which is a sub-object generated by Proxy, which controls the TCP connection. ''' def print_tables(self): ''' Print all tables in the CyberDB database. Return Type: None ''' def delete_table(self, table_name: str): ''' Drop the table_name table in the CyberDB database. Parameters: table_name \u2013 the name of the table to drop. Return Type: None '''","title":"Proxy Class"},{"location":"API/#cyberdbcyberdict-class","text":"class cyberdb.CyberDict A child object generated by a Proxy object for performing Dictionaries operations. This object will perform remote operations on the server-side CyberDB database. Shares the same TCP connection with the Proxy object. The connection will follow the connection of the Proxy. After the Proxy releases the connection, the object will also lose the connection. CyberDict can execute the get, setdefault, update, keys, values, items, pop, popitem, clear methods and common magic methods of Dictionaries, please refer to Python dictionary official documentation . Iterate over CyberDict using a for loop with client space complexity o(n), where n is the length of CyberDict.keys() . def todict(self) -> Dict: ''' Convert CyberDict to Dictionaries. Return Type: Dict '''","title":"cyberdb.CyberDict Class"},{"location":"API/#cyberdbcyberlist","text":"class cyberdb.CyberList A child object generated by a Proxy object for performing Lists operations. This object will perform remote operations on the server-side CyberDB database. Shares the same TCP connection with the Proxy object. The connection will follow the connection of the Proxy. After the Proxy releases the connection, the object will also lose the connection. CyberList can execute the append, extend, insert, pop, remove, count, index, reverse, sort, clear methods and common magic methods of Lists, please refer to Python List Official Documentation . The CyberList is iterated using a for loop, each iteration will fetch the content from the server, and the space complexity of the client is o(1). def tolist(self) -> List: ''' Convert CyberList to Lists. Return Type: List '''","title":"cyberdb.CyberList \u7c7b"}]}
\ No newline at end of file
diff --git a/documentation/site/sitemap.xml.gz b/documentation/site/sitemap.xml.gz
index 82439f799918dc7544656606b61ce9f4cd124fbe..ea0712e507bcdeb1f4febea572b966894c3e6709 100644
GIT binary patch
delta 14
Vcmcc0c$JY&zMF$%M(RYi^8h0C1keBg

delta 14
Vcmcc0c$JY&zMF$XOMfEUc>o{x1S|jm

diff --git a/documentation_chn/docs/index.md b/documentation_chn/docs/index.md
index 1327c2c..d7254c3 100644
--- a/documentation_chn/docs/index.md
+++ b/documentation_chn/docs/index.md
@@ -301,7 +301,7 @@ for v in list1:
     99
 
 
-强烈推荐使用 for 循环迭代 CyberDict,每次迭代将从服务端获取 v,客户端的空间复杂度为 o(1)。迭代同样可用于 CyberDict,CyberDict 的迭代中,客户端空间复杂度为 o(n), n 为 CyberDict.keys() 的长度。
+强烈推荐使用 for 循环迭代 CyberList,每次迭代将从服务端获取 v,客户端的空间复杂度为 o(1)。迭代同样可用于 CyberDict,CyberDict 的迭代中,客户端空间复杂度为 o(n), n 为 CyberDict.keys() 的长度。
 
 #### 释放 proxy 对象
 
diff --git a/documentation_chn/site/index.html b/documentation_chn/site/index.html
index fe95b3b..e6a038e 100644
--- a/documentation_chn/site/index.html
+++ b/documentation_chn/site/index.html
@@ -251,7 +251,7 @@ 
CyberList 常用操作
100 99
-

强烈推荐使用 for 循环迭代 CyberDict,每次迭代将从服务端获取 v,客户端的空间复杂度为 o(1)。迭代同样可用于 CyberDict,CyberDict 的迭代中,客户端空间复杂度为 o(n), n 为 CyberDict.keys() 的长度。

+

强烈推荐使用 for 循环迭代 CyberList,每次迭代将从服务端获取 v,客户端的空间复杂度为 o(1)。迭代同样可用于 CyberDict,CyberDict 的迭代中,客户端空间复杂度为 o(n), n 为 CyberDict.keys() 的长度。

释放 proxy 对象

使用完成,将 proxy 的连接归还至连接池即可。

proxy.close()
@@ -347,5 +347,5 @@ 
 
 
diff --git a/documentation_chn/site/search/search_index.json b/documentation_chn/site/search/search_index.json
index 1bcfbc1..6e8c27e 100644
--- a/documentation_chn/site/search/search_index.json
+++ b/documentation_chn/site/search/search_index.json
@@ -1 +1 @@
-{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"CyberDB CyberDB \u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684 Python \u5185\u5b58\u6570\u636e\u5e93\u3002\u5b83\u65e8\u5728\u5229\u7528 Python \u5185\u7f6e\u6570\u636e\u7ed3\u6784 Dictionaries\u3001Lists \u4f5c\u6570\u636e\u5b58\u50a8\uff0c\u901a\u8fc7 Socket TCP \u9ad8\u6548\u901a\u4fe1\uff0c\u5e76\u63d0\u4f9b\u6570\u636e\u6301\u4e45\u5316\u3002\u8be5\u6a21\u5757\u5e38\u7528\u4e8e Gunicorn \u8fdb\u7a0b\u95f4\u901a\u4fe1\u3001\u5206\u5e03\u5f0f\u8ba1\u7b97 \u7b49\u9886\u57df\u3002 \u5b89\u88c5\u65b9\u6cd5 1.\u8fdb\u5165\u547d\u4ee4\u7a97\u53e3\uff0c\u521b\u5efa\u865a\u62df\u73af\u5883\uff0c\u4f9d\u6b21\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4 Linux \u548c macOS: python3 -m venv venv # \u521b\u5efa\u865a\u62df\u73af\u5883 . venv/bin/activate # \u6fc0\u6d3b\u865a\u62df\u73af\u5883 Windows: python -m venv venv # \u521b\u5efa\u865a\u62df\u73af\u5883 venv\\Scripts\\activate # \u6fc0\u6d3b\u865a\u62df\u73af\u5883 2.\u5b89\u88c5 CyberDB\uff0c\u4f9d\u6b21\u8f93\u5165 pip install --upgrade pip pip install cyberdb \u5982\u679c\u4f60\u7684\u670d\u52a1\u7aef\u548c\u5ba2\u6237\u7aef\u5728\u4e24\u4e2a\u4e0d\u540c\u7684\u9879\u76ee\u76ee\u5f55\u8fd0\u884c\uff0c\u8bf7\u5206\u522b\u5728\u670d\u52a1\u7aef\u3001\u5ba2\u6237\u7aef\u7684\u865a\u62df\u73af\u5883\u4e2d\u5b89\u88c5 CyberDB\u3002 \u94fe\u63a5 GitHub: https://github.com/Cyberbolt/CyberDB PyPI: https://pypi.org/project/CyberDB/ \u6587\u6863: https://www.cyberlight.xyz/static/cyberdb-chn \u7535\u5149\u7b14\u8bb0: https://www.cyberlight.xyz/ \u5feb\u901f\u4f7f\u7528 \u8be5\u6a21\u5757\u4e2d\u8bf7\u4f7f\u7528 CyberDict \u548c CyberList \u66ff\u4ee3 dict \u548c list \uff08\u4e00\u79cd\u57fa\u4e8e TCP \u7684\u7c7b Dictionaries\u3001\u7c7b Lists \u5bf9\u8c61\uff09\u3002 \u670d\u52a1\u7aef \u670d\u52a1\u7aef\u521d\u59cb\u5316\uff0c\u8bbe\u7f6e\u5907\u4efd\u548c TCP \u76d1\u542c\u5730\u5740\u3002 import time import cyberdb db = cyberdb.Server() # \u6570\u636e\u6301\u4e45\u5316\uff0c\u5907\u4efd\u6587\u4ef6\u4e3a data.cdb\uff0c\u5907\u4efd\u5468\u671f 900 \u79d2\u4e00\u6b21\u3002 db.set_backup('data.cdb', cycle=900) # \u8bbe\u7f6e TCP \u5730\u5740\u3001\u7aef\u53e3\u53f7\u3001\u5bc6\u7801\uff0c\u751f\u4ea7\u73af\u5883\u4e2d\u5bc6\u7801\u5efa\u8bae\u4f7f\u7528\u5927\u5c0f\u5199\u5b57\u6bcd\u548c\u6570\u5b57\u7684\u7ec4\u5408\u3002 # start \u65b9\u6cd5\u4e0d\u4f1a\u963b\u585e\u8fd0\u884c\uff0c\u82e5\u5e0c\u671b\u8be5\u64cd\u4f5c\u963b\u585e\uff0c\u8bf7\u4f7f\u7528 run \u65b9\u6cd5\u4ee3\u66ff start\uff0c\u53c2\u6570\u4e0d\u53d8\u3002 db.start(host='127.0.0.1', port=9980, password='123456') while True: time.sleep(10000) \u4e0a\u8ff0\u670d\u52a1\u7aef\u8fd0\u884c\u540e\uff0c\u6bcf 900 \u79d2\u5c06\u5728\u6b64\u9879\u76ee\u6839\u76ee\u5f55\u751f\u6210\uff08\u6216\u8986\u76d6\uff09data.cdb\u3002\u4e0b\u6b21\u542f\u52a8\u6570\u636e\u5e93\u53ef\u4f7f\u7528 load \u65b9\u6cd5\u8bfb\u53d6\u8be5\u6587\u4ef6\u3002 \u5ba2\u6237\u7aef \u8fde\u63a5\u6570\u636e\u5e93 import cyberdb # \u751f\u6210\u5ba2\u6237\u7aef\u5b9e\u4f8b\u5e76\u8fde\u63a5\u3002 client = cyberdb.connect(host='127.0.0.1', port=9980, password='123456') \u751f\u6210 proxy \u5bf9\u8c61 # \u751f\u6210\u672c\u6b21\u8bf7\u6c42\u7684 proxy\u3002 proxy = client.get_proxy() # \u4ece\u8fde\u63a5\u6c60\u81ea\u52a8\u83b7\u53d6\u6570\u636e\u5e93\u8fde\u63a5\u3002 proxy.connect() \u5efa\u8bae\u5728\u6bcf\u4e2a\u7ebf\u7a0b(\u6216\u534f\u7a0b)\u4e2d\u5355\u72ec\u751f\u6210 proxy \u5bf9\u8c61\uff0c\u5e76\u901a\u8fc7 connect \u65b9\u6cd5\u83b7\u53d6\u6570\u636e\u5e93\u8fde\u63a5\u3002\u4f60\u53ea\u9700\u5728\u64cd\u4f5c\u5b8c\u6210\u540e\u4f7f\u7528 close \u65b9\u6cd5\u5f52\u8fd8\u8fde\u63a5\u5373\u53ef\uff0c\u5f52\u8fd8\u540e\u7684\u8fde\u63a5\u7531 client \u5bf9\u8c61\u667a\u80fd\u7ba1\u7406\u3002 \u64cd\u4f5c proxy \u5bf9\u8c61 \u521b\u5efa CyberDict \u548c CyberList # \u5728\u6570\u636e\u5e93\u4e2d\u5206\u522b\u521b\u5efa\u7c7b\u578b\u4e3a CyberDict \u7684 dict1\u3001dict2 \u8868\uff0c # \u7c7b\u578b\u4e3a CyberList \u7684 list1 \u8868\u3002 proxy.create_cyberdict('dict1') proxy.create_cyberdict('dict2') proxy.create_cyberlist('list1') dict1 = proxy.get_cyberdict('dict1') dict2 = proxy.get_cyberdict('dict2') list1 = proxy.get_cyberlist('list1') \u6b64\u5904\u83b7\u53d6\u7684 dict1\u3001dict2\u3001list1 \u5747\u4e3a\u7f51\u7edc\u5bf9\u8c61\uff0c\u6570\u636e\u901a\u8fc7 TCP \u4f20\u8f93\u3002\u4e09\u4e2a\u5bf9\u8c61\u53d7 proxy \u63a7\u5236\uff0c\u5f53\u8c03\u7528 proxy.close() \u5f52\u8fd8\u8fde\u63a5\u540e\uff0c\u4e09\u4e2a\u5bf9\u8c61\u4e5f\u4f1a\u5931\u6548\u3002\u540c\u6837\uff0c\u4f7f\u7528 proxy.connect() \u53ef\u91cd\u65b0\u4ece\u8fde\u63a5\u6c60\u83b7\u53d6\u8fde\u63a5\uff0cdict1\u3001dict2\u3001list1 \u4e5f\u53d8\u4e3a\u53ef\u7528\u3002 \u4e86\u89e3\u6b64\u64cd\u4f5c\u540e\uff0c\u4f60\u4fbf\u53ef\u4ee5\u50cf\u64cd\u4f5c Dictionaries \u4e00\u6837\u64cd\u4f5c dict1\u3001dict2\uff0c\u50cf\u64cd\u4f5c Lists \u4e00\u6837\u64cd\u4f5c list1 \u4e86\uff01\uff08CyberDict \u548c CyberList \u652f\u6301 Dictionaries\u3001Lists \u7684\u5927\u90e8\u5206\u65b9\u6cd5\uff09 \u793a\u4f8b\u5982\u4e0b CyberDict \u5e38\u7528\u64cd\u4f5c \u5728 dict1 \u548c dict2 \u4e2d\u65b0\u589e\u952e\u503c\u5bf9 dict1[0] = 100 dict1['test'] = 'Hello CyberDB!' dict2[0] = 200 \u83b7\u53d6\u5bf9\u5e94\u7684\u503c dict1.get(0) 100 dict2[0] 200 \u67e5\u770b dict1 \u548c dict2 (\u4e5f\u53ef\u4ee5\u4f7f\u7528 print \u6253\u5370) dict1 {0: 100, 'test': 'Hello CyberDB!'} dict2 {0: 200} \u83b7\u53d6\u957f\u5ea6 len(dict1) 2 \u5220\u9664\u952e\u503c\u5bf9 del dict1[0] dict1 {'test': 'Hello CyberDB!'} \u6e05\u7a7a dict1 dict1.clear() dict1 {} CyberList \u5e38\u7528\u64cd\u4f5c \u751f\u6210 list1 \u7684\u5185\u5bb9 for i in range(5): list1.append(99) list1 [99, 99, 99, 99, 99] \u66f4\u6539\u5750\u6807\u503c list1[3] = 100 list1 [99, 99, 99, 100, 99] \u8fdb\u884c\u5207\u7247 list1[3:] [100, 99] \u83b7\u53d6 list1 \u7684\u957f\u5ea6 len(list1) 5 \u901a\u8fc7\u8fed\u4ee3\u6253\u5370 list1 \u6bcf\u4e2a\u5143\u7d20 for v in list1: print(v) 99 99 99 100 99 \u5f3a\u70c8\u63a8\u8350\u4f7f\u7528 for \u5faa\u73af\u8fed\u4ee3 CyberDict\uff0c\u6bcf\u6b21\u8fed\u4ee3\u5c06\u4ece\u670d\u52a1\u7aef\u83b7\u53d6 v\uff0c\u5ba2\u6237\u7aef\u7684\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a o(1)\u3002\u8fed\u4ee3\u540c\u6837\u53ef\u7528\u4e8e CyberDict\uff0cCyberDict \u7684\u8fed\u4ee3\u4e2d\uff0c\u5ba2\u6237\u7aef\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a o(n), n \u4e3a CyberDict.keys() \u7684\u957f\u5ea6\u3002 \u91ca\u653e proxy \u5bf9\u8c61 \u4f7f\u7528\u5b8c\u6210\uff0c\u5c06 proxy \u7684\u8fde\u63a5\u5f52\u8fd8\u81f3\u8fde\u63a5\u6c60\u5373\u53ef\u3002 proxy.close() proxy \u5bf9\u8c61\u540c\u6837\u652f\u6301\u4e0a\u4e0b\u6587\u7ba1\u7406\u5668\uff0c\u5982 with client.get_proxy() as proxy: list1 = proxy.get_cyberlist('list1') print(list1) [99, 99, 99, 100, 99] \u6982\u62ec \u6709\u4e86 CyberDB\uff0c\u4fbf\u80fd\u5145\u5206\u5229\u7528\u5185\u5b58\u6027\u80fd\uff0c\u4e0d\u540c\u8fdb\u7a0b(\u751a\u81f3\u4e0d\u540c\u4e3b\u673a)\u80fd\u901a\u8fc7 Python \u7684\u6570\u636e\u7ed3\u6784\u901a\u4fe1\u3002\u611f\u8c22\u4f60\u7684\u652f\u6301\uff01 \u6ce8\u610f \u7531\u4e8e\u7f16\u7801\u9650\u5236\uff0cCyberDB \u4f1a\u5c06 0 \u8bc6\u522b\u4e3a None\uff0c\u4f46\u5e76\u4e0d\u5f71\u54cd\u8ba1\u7b97\uff0c\u8bf7\u5728\u6240\u9700\u4f4d\u7f6e\u5c06 None \u8f6c\u4e3a 0\u3002","title":"\u4e3b\u9875"},{"location":"#cyberdb","text":"CyberDB \u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684 Python \u5185\u5b58\u6570\u636e\u5e93\u3002\u5b83\u65e8\u5728\u5229\u7528 Python \u5185\u7f6e\u6570\u636e\u7ed3\u6784 Dictionaries\u3001Lists \u4f5c\u6570\u636e\u5b58\u50a8\uff0c\u901a\u8fc7 Socket TCP \u9ad8\u6548\u901a\u4fe1\uff0c\u5e76\u63d0\u4f9b\u6570\u636e\u6301\u4e45\u5316\u3002\u8be5\u6a21\u5757\u5e38\u7528\u4e8e Gunicorn \u8fdb\u7a0b\u95f4\u901a\u4fe1\u3001\u5206\u5e03\u5f0f\u8ba1\u7b97 \u7b49\u9886\u57df\u3002","title":"CyberDB"},{"location":"#_1","text":"1.\u8fdb\u5165\u547d\u4ee4\u7a97\u53e3\uff0c\u521b\u5efa\u865a\u62df\u73af\u5883\uff0c\u4f9d\u6b21\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4 Linux \u548c macOS: python3 -m venv venv # \u521b\u5efa\u865a\u62df\u73af\u5883 . venv/bin/activate # \u6fc0\u6d3b\u865a\u62df\u73af\u5883 Windows: python -m venv venv # \u521b\u5efa\u865a\u62df\u73af\u5883 venv\\Scripts\\activate # \u6fc0\u6d3b\u865a\u62df\u73af\u5883 2.\u5b89\u88c5 CyberDB\uff0c\u4f9d\u6b21\u8f93\u5165 pip install --upgrade pip pip install cyberdb \u5982\u679c\u4f60\u7684\u670d\u52a1\u7aef\u548c\u5ba2\u6237\u7aef\u5728\u4e24\u4e2a\u4e0d\u540c\u7684\u9879\u76ee\u76ee\u5f55\u8fd0\u884c\uff0c\u8bf7\u5206\u522b\u5728\u670d\u52a1\u7aef\u3001\u5ba2\u6237\u7aef\u7684\u865a\u62df\u73af\u5883\u4e2d\u5b89\u88c5 CyberDB\u3002","title":"\u5b89\u88c5\u65b9\u6cd5"},{"location":"#_2","text":"GitHub: https://github.com/Cyberbolt/CyberDB PyPI: https://pypi.org/project/CyberDB/ \u6587\u6863: https://www.cyberlight.xyz/static/cyberdb-chn \u7535\u5149\u7b14\u8bb0: https://www.cyberlight.xyz/","title":"\u94fe\u63a5"},{"location":"#_3","text":"\u8be5\u6a21\u5757\u4e2d\u8bf7\u4f7f\u7528 CyberDict \u548c CyberList \u66ff\u4ee3 dict \u548c list \uff08\u4e00\u79cd\u57fa\u4e8e TCP \u7684\u7c7b Dictionaries\u3001\u7c7b Lists \u5bf9\u8c61\uff09\u3002","title":"\u5feb\u901f\u4f7f\u7528"},{"location":"#_4","text":"\u670d\u52a1\u7aef\u521d\u59cb\u5316\uff0c\u8bbe\u7f6e\u5907\u4efd\u548c TCP \u76d1\u542c\u5730\u5740\u3002 import time import cyberdb db = cyberdb.Server() # \u6570\u636e\u6301\u4e45\u5316\uff0c\u5907\u4efd\u6587\u4ef6\u4e3a data.cdb\uff0c\u5907\u4efd\u5468\u671f 900 \u79d2\u4e00\u6b21\u3002 db.set_backup('data.cdb', cycle=900) # \u8bbe\u7f6e TCP \u5730\u5740\u3001\u7aef\u53e3\u53f7\u3001\u5bc6\u7801\uff0c\u751f\u4ea7\u73af\u5883\u4e2d\u5bc6\u7801\u5efa\u8bae\u4f7f\u7528\u5927\u5c0f\u5199\u5b57\u6bcd\u548c\u6570\u5b57\u7684\u7ec4\u5408\u3002 # start \u65b9\u6cd5\u4e0d\u4f1a\u963b\u585e\u8fd0\u884c\uff0c\u82e5\u5e0c\u671b\u8be5\u64cd\u4f5c\u963b\u585e\uff0c\u8bf7\u4f7f\u7528 run \u65b9\u6cd5\u4ee3\u66ff start\uff0c\u53c2\u6570\u4e0d\u53d8\u3002 db.start(host='127.0.0.1', port=9980, password='123456') while True: time.sleep(10000) \u4e0a\u8ff0\u670d\u52a1\u7aef\u8fd0\u884c\u540e\uff0c\u6bcf 900 \u79d2\u5c06\u5728\u6b64\u9879\u76ee\u6839\u76ee\u5f55\u751f\u6210\uff08\u6216\u8986\u76d6\uff09data.cdb\u3002\u4e0b\u6b21\u542f\u52a8\u6570\u636e\u5e93\u53ef\u4f7f\u7528 load \u65b9\u6cd5\u8bfb\u53d6\u8be5\u6587\u4ef6\u3002","title":"\u670d\u52a1\u7aef"},{"location":"#_5","text":"","title":"\u5ba2\u6237\u7aef"},{"location":"#_6","text":"import cyberdb # \u751f\u6210\u5ba2\u6237\u7aef\u5b9e\u4f8b\u5e76\u8fde\u63a5\u3002 client = cyberdb.connect(host='127.0.0.1', port=9980, password='123456')","title":"\u8fde\u63a5\u6570\u636e\u5e93"},{"location":"#proxy","text":"# \u751f\u6210\u672c\u6b21\u8bf7\u6c42\u7684 proxy\u3002 proxy = client.get_proxy() # \u4ece\u8fde\u63a5\u6c60\u81ea\u52a8\u83b7\u53d6\u6570\u636e\u5e93\u8fde\u63a5\u3002 proxy.connect() \u5efa\u8bae\u5728\u6bcf\u4e2a\u7ebf\u7a0b(\u6216\u534f\u7a0b)\u4e2d\u5355\u72ec\u751f\u6210 proxy \u5bf9\u8c61\uff0c\u5e76\u901a\u8fc7 connect \u65b9\u6cd5\u83b7\u53d6\u6570\u636e\u5e93\u8fde\u63a5\u3002\u4f60\u53ea\u9700\u5728\u64cd\u4f5c\u5b8c\u6210\u540e\u4f7f\u7528 close \u65b9\u6cd5\u5f52\u8fd8\u8fde\u63a5\u5373\u53ef\uff0c\u5f52\u8fd8\u540e\u7684\u8fde\u63a5\u7531 client \u5bf9\u8c61\u667a\u80fd\u7ba1\u7406\u3002","title":"\u751f\u6210 proxy \u5bf9\u8c61"},{"location":"#proxy_1","text":"\u521b\u5efa CyberDict \u548c CyberList # \u5728\u6570\u636e\u5e93\u4e2d\u5206\u522b\u521b\u5efa\u7c7b\u578b\u4e3a CyberDict \u7684 dict1\u3001dict2 \u8868\uff0c # \u7c7b\u578b\u4e3a CyberList \u7684 list1 \u8868\u3002 proxy.create_cyberdict('dict1') proxy.create_cyberdict('dict2') proxy.create_cyberlist('list1') dict1 = proxy.get_cyberdict('dict1') dict2 = proxy.get_cyberdict('dict2') list1 = proxy.get_cyberlist('list1') \u6b64\u5904\u83b7\u53d6\u7684 dict1\u3001dict2\u3001list1 \u5747\u4e3a\u7f51\u7edc\u5bf9\u8c61\uff0c\u6570\u636e\u901a\u8fc7 TCP \u4f20\u8f93\u3002\u4e09\u4e2a\u5bf9\u8c61\u53d7 proxy \u63a7\u5236\uff0c\u5f53\u8c03\u7528 proxy.close() \u5f52\u8fd8\u8fde\u63a5\u540e\uff0c\u4e09\u4e2a\u5bf9\u8c61\u4e5f\u4f1a\u5931\u6548\u3002\u540c\u6837\uff0c\u4f7f\u7528 proxy.connect() \u53ef\u91cd\u65b0\u4ece\u8fde\u63a5\u6c60\u83b7\u53d6\u8fde\u63a5\uff0cdict1\u3001dict2\u3001list1 \u4e5f\u53d8\u4e3a\u53ef\u7528\u3002 \u4e86\u89e3\u6b64\u64cd\u4f5c\u540e\uff0c\u4f60\u4fbf\u53ef\u4ee5\u50cf\u64cd\u4f5c Dictionaries \u4e00\u6837\u64cd\u4f5c dict1\u3001dict2\uff0c\u50cf\u64cd\u4f5c Lists \u4e00\u6837\u64cd\u4f5c list1 \u4e86\uff01\uff08CyberDict \u548c CyberList \u652f\u6301 Dictionaries\u3001Lists \u7684\u5927\u90e8\u5206\u65b9\u6cd5\uff09 \u793a\u4f8b\u5982\u4e0b","title":"\u64cd\u4f5c proxy \u5bf9\u8c61"},{"location":"#cyberdict","text":"\u5728 dict1 \u548c dict2 \u4e2d\u65b0\u589e\u952e\u503c\u5bf9 dict1[0] = 100 dict1['test'] = 'Hello CyberDB!' dict2[0] = 200 \u83b7\u53d6\u5bf9\u5e94\u7684\u503c dict1.get(0) 100 dict2[0] 200 \u67e5\u770b dict1 \u548c dict2 (\u4e5f\u53ef\u4ee5\u4f7f\u7528 print \u6253\u5370) dict1 {0: 100, 'test': 'Hello CyberDB!'} dict2 {0: 200} \u83b7\u53d6\u957f\u5ea6 len(dict1) 2 \u5220\u9664\u952e\u503c\u5bf9 del dict1[0] dict1 {'test': 'Hello CyberDB!'} \u6e05\u7a7a dict1 dict1.clear() dict1 {}","title":"CyberDict \u5e38\u7528\u64cd\u4f5c"},{"location":"#cyberlist","text":"\u751f\u6210 list1 \u7684\u5185\u5bb9 for i in range(5): list1.append(99) list1 [99, 99, 99, 99, 99] \u66f4\u6539\u5750\u6807\u503c list1[3] = 100 list1 [99, 99, 99, 100, 99] \u8fdb\u884c\u5207\u7247 list1[3:] [100, 99] \u83b7\u53d6 list1 \u7684\u957f\u5ea6 len(list1) 5 \u901a\u8fc7\u8fed\u4ee3\u6253\u5370 list1 \u6bcf\u4e2a\u5143\u7d20 for v in list1: print(v) 99 99 99 100 99 \u5f3a\u70c8\u63a8\u8350\u4f7f\u7528 for \u5faa\u73af\u8fed\u4ee3 CyberDict\uff0c\u6bcf\u6b21\u8fed\u4ee3\u5c06\u4ece\u670d\u52a1\u7aef\u83b7\u53d6 v\uff0c\u5ba2\u6237\u7aef\u7684\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a o(1)\u3002\u8fed\u4ee3\u540c\u6837\u53ef\u7528\u4e8e CyberDict\uff0cCyberDict \u7684\u8fed\u4ee3\u4e2d\uff0c\u5ba2\u6237\u7aef\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a o(n), n \u4e3a CyberDict.keys() \u7684\u957f\u5ea6\u3002","title":"CyberList \u5e38\u7528\u64cd\u4f5c"},{"location":"#proxy_2","text":"\u4f7f\u7528\u5b8c\u6210\uff0c\u5c06 proxy \u7684\u8fde\u63a5\u5f52\u8fd8\u81f3\u8fde\u63a5\u6c60\u5373\u53ef\u3002 proxy.close() proxy \u5bf9\u8c61\u540c\u6837\u652f\u6301\u4e0a\u4e0b\u6587\u7ba1\u7406\u5668\uff0c\u5982 with client.get_proxy() as proxy: list1 = proxy.get_cyberlist('list1') print(list1) [99, 99, 99, 100, 99]","title":"\u91ca\u653e proxy \u5bf9\u8c61"},{"location":"#_7","text":"\u6709\u4e86 CyberDB\uff0c\u4fbf\u80fd\u5145\u5206\u5229\u7528\u5185\u5b58\u6027\u80fd\uff0c\u4e0d\u540c\u8fdb\u7a0b(\u751a\u81f3\u4e0d\u540c\u4e3b\u673a)\u80fd\u901a\u8fc7 Python \u7684\u6570\u636e\u7ed3\u6784\u901a\u4fe1\u3002\u611f\u8c22\u4f60\u7684\u652f\u6301\uff01","title":"\u6982\u62ec"},{"location":"#_8","text":"\u7531\u4e8e\u7f16\u7801\u9650\u5236\uff0cCyberDB \u4f1a\u5c06 0 \u8bc6\u522b\u4e3a None\uff0c\u4f46\u5e76\u4e0d\u5f71\u54cd\u8ba1\u7b97\uff0c\u8bf7\u5728\u6240\u9700\u4f4d\u7f6e\u5c06 None \u8f6c\u4e3a 0\u3002","title":"\u6ce8\u610f"},{"location":"API/","text":"API \u8fd9\u90e8\u5206\u6587\u6863\u6db5\u76d6\u4e86 CyberDB \u7684\u6240\u6709\u63a5\u53e3\u3002\u5bf9\u4e8e CyberDB \u4f9d\u8d56\u4e8e\u5916\u90e8\u5e93\u7684\u90e8\u5206\uff0c\u6211\u4eec\u5728\u6b64\u5904\u8bb0\u5f55\u6700\u91cd\u8981\u7684\u90e8\u5206\u5e76\u63d0\u4f9b\u6307\u5411\u89c4\u8303\u6587\u6863\u7684\u94fe\u63a5\u3002 cyberdb.Server \u7c7b class cyberdb.Server \u8be5\u7c7b\u7528\u4e8e\u521b\u5efa CyberDB \u670d\u52a1\u7aef\u5bf9\u8c61\u3002 def start(self, host: str = '127.0.0.1', port: int = 9980, password: str = None, max_con: int = 500, timeout: int = 0, print_log: bool = False, encrypt: bool = False): ''' \u540e\u53f0\u542f\u52a8 CyberDB \u670d\u52a1\u5668\uff0c\u8be5\u64cd\u4f5c\u4e0d\u4f1a\u963b\u585e\u524d\u53f0\u4efb\u52a1\u3002 \u53c2\u6570: host -- TCP \u76d1\u542c\u4e3b\u673a\u5730\u5740\uff0c\u5982 127.0.0.1\u3002 port -- TCP \u76d1\u542c\u7aef\u53e3\u3002 password -- TCP \u901a\u4fe1\u5bc6\u7801\uff0c\u5efa\u8bae\u91c7\u7528 \u82f1\u6587\u5b57\u6bcd\u548c\u6570\u5b57\u7684\u7ec4\u5408\u65b9\u5f0f\uff0c \u6700\u957f\u4e0d\u8d85\u8fc7 32 \u4e2a\u5b57\u7b26\u3002 max_con -- \u6700\u5927\u5e76\u53d1\u6570\u3002 timeout -- \u5355\u4e2a\u8fde\u63a5\u7684\u8d85\u65f6\u65f6\u95f4\uff0c\u5355\u4f4d \u79d2\u3002 print_log -- \u662f\u5426\u6253\u5370\u901a\u4fe1\u65e5\u5fd7\uff0cFasle \u4e3a\u4e0d\u6253\u5370\u3002 encrypt -- \u662f\u5426\u52a0\u5bc6\u901a\u4fe1\u5185\u5bb9\uff0cFasle \u4e3a\u4e0d\u52a0\u5bc6\u3002\u6b64\u52a0\u5bc6\u7b97\u6cd5\u4e3a AES-256\uff0c\u5bc6\u94a5\u4e3a password\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def run(self, host: str = '127.0.0.1', port: int = 9980, password: str = None, max_con: int = 500, timeout: int = 0, print_log: bool = False, encrypt: bool = False): ''' \u524d\u53f0\u8fd0\u884c CyberDB \u670d\u52a1\u5668\uff0c\u8be5\u64cd\u4f5c\u4f1a\u963b\u585e\u524d\u53f0\u4efb\u52a1\u3002 \u53c2\u6570\u548c start \u65b9\u6cd5\u76f8\u540c\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def set_ip_whitelist(self, ips: list): ''' \u8bbe\u7f6e ip \u767d\u540d\u5355\uff0cCyberDB \u52a0\u5bc6\u901a\u4fe1\u65f6\u4ec5\u5141\u8bb8\u767d\u540d\u5355\u7684 ip \u8fde\u63a5\uff0c \u8be5\u65b9\u6cd5\u4ec5\u5728 cyberdb.Server.start(encrypt=True) \u6216 cyberdb.Server.run(encrypt=True) \u542f\u7528\u65f6\u6709\u6548\u3002 \u53c2\u6570: ips -- \u7c7b\u578b\u4e3a\u5217\u8868\uff0c\u683c\u5f0f\u5982 ['192.168.1.1', '118.123.89.137'] \u8fd4\u56de\u7c7b\u578b: None ''' def set_backup(self, file_name: str = 'data.cdb', cycle: int = 900): ''' \u8bbe\u7f6e\u5b9a\u65f6\u5907\u4efd\uff0c\u8be5\u64cd\u4f5c\u8bbe\u7f6e\u540e\uff0c\u5c06\u5728\u6307\u5b9a\u5468\u671f\u8fdb\u884c\u6570\u636e\u6301\u4e45\u5316\u5907\u4efd\uff0c\u5c06 CyberDB \u6570\u636e\u5e93\u4fdd\u5b58\u81f3\u786c\u76d8\u3002 \u53c2\u6570: file_name -- \u5907\u4efd\u751f\u6210\u7684\u6587\u4ef6\u540d\uff0c\u6587\u4ef6\u540e\u7f00\u5fc5\u987b\u662f .cdb\u3002 cycle -- \u5faa\u73af\u5907\u4efd\u7684\u5468\u671f\uff0c\u5355\u4f4d \u79d2\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def save_db(self, file_name: str = 'data.cdb'): ''' \u6570\u636e\u6301\u4e45\u5316\uff0c\u5c06 CyberDB \u6570\u636e\u5e93\u4fdd\u5b58\u81f3\u786c\u76d8\u3002 \u53c2\u6570: file_name -- \u5907\u4efd\u751f\u6210\u7684\u6587\u4ef6\u540d\uff0c\u6587\u4ef6\u540e\u7f00\u5fc5\u987b\u662f .cdb\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def load_db(self, file_name: str = 'data.cdb'): ''' \u52a0\u8f7d .cdb \u683c\u5f0f\u7684\u6587\u4ef6\uff0c\u5c06\u786c\u76d8\u4e2d\u5907\u4efd\u7684 CyberDB \u6570\u636e\u5e93\u52a0\u8f7d\u56de\u5185\u5b58\u3002 \u53c2\u6570: file_name -- \u7ecf\u6570\u636e\u6301\u4e45\u5316\u751f\u6210\u7684\u6587\u4ef6\u540d\uff0c\u6587\u4ef6\u540e\u7f00\u5fc5\u987b\u662f .cdb\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' cyberdb.connect \u51fd\u6570 def cyberdb.connect(host: str = '127.0.0.1', port: int = 9980, password: str = None, encrypt: bool = False, time_out: int = None) -> Client: ''' \u5c06\u5ba2\u6237\u7aef\u8fde\u63a5\u81f3 CyberDB \u670d\u52a1\u7aef\u3002 \u53c2\u6570: host -- \u8fde\u63a5\u5730\u5740\uff0c\u5982 127.0.0.1 port -- \u8fde\u63a5\u7aef\u53e3 password -- \u8fde\u63a5\u5bc6\u7801 encrypt -- \u662f\u5426\u52a0\u5bc6\u901a\u4fe1\uff0c\u5982\u679c\u670d\u52a1\u7aef\u542f\u7528 encrypt \u4e3a True\uff0c\u6b64\u5904\u5fc5\u987b\u4e3a True\uff0c\u53cd\u4e4b\u4ea6\u7136\u3002 time_out -- \u8fde\u63a5\u6c60\u4e2d\u6bcf\u4e2a\u8fde\u63a5\u7684\u8d85\u65f6\u65f6\u95f4\uff0c\u5355\u4f4d \u79d2\u3002\u8fde\u63a5\u6c60\u7684\u8fde\u63a5\u7ecf time_out \u79d2\u65e0\u64cd\u4f5c\u5c06\u88ab\u820d\u5f03\uff0c\u4e0b\u6b21\u8fde\u63a5\u5c06\u751f\u6210\u65b0\u8fde\u63a5\u3002\u8fde\u63a5\u6c60\u5c06\u81ea\u52a8\u7ba1\u7406\u8fde\u63a5\uff0c\u5f00\u53d1\u8005\u65e0\u9700\u5173\u6ce8\u7ec6\u8282\u3002 \u6b64\u53c2\u6570\u82e5\u4e3a None\uff0c\u5219\u4e0d\u4f1a\u8d85\u65f6\uff0c\u8fde\u63a5\u6c60\u5c06\u7ef4\u6301\u8fde\u63a5\u76f4\u81f3\u5931\u6548\uff0c\u4e4b\u540e\u5c06\u91cd\u65b0\u751f\u6210\u65b0\u8fde\u63a5\u3002 \u8fd4\u56de\u7c7b\u578b: Client ''' cyberdb.Client \u7c7b class cyberdb.Client cyberdb.connect \u51fd\u6570\u8fd4\u56de\u7684 cyberdb.Client \u5bf9\u8c61\uff0c\u7528\u4e8e\u751f\u6210 Proxy \u5bf9\u8c61\u3002 def get_proxy(self) -> Proxy: ''' \u751f\u6210 Proxy \u5bf9\u8c61\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' Proxy \u7c7b cyberdb.Client.get_proxy \u65b9\u6cd5\u751f\u6210\u7684 Proxy \u5bf9\u8c61\uff0c\u53ef\u5bf9 CyberDB \u6570\u636e\u5e93\u8fdb\u884c\u64cd\u4f5c\uff0c\u5e76\u7ba1\u7406\u7531 Proxy \u751f\u6210\u7684 CyberDict\u3001CyberList \u5b50\u5bf9\u8c61\u7684 TCP \u8fde\u63a5\u3002Proxy \u5bf9\u8c61\u521d\u59cb\u5316\u540e\uff0c\u6267\u884c Proxy.connect \u65b9\u6cd5\u540e\u624d\u80fd\u4f7f\u7528\u3002Proxy \u5bf9\u8c61\u53ca\u5176\u5b50\u5bf9\u8c61\u5c06\u6267\u884c\u8fdc\u7a0b\u64cd\u4f5c\uff0c\u4f5c\u7528\u4e8e\u670d\u52a1\u7aef CyberDB \u6570\u636e\u5e93\u3002 class Proxy def connect(self): ''' \u4ece\u8fde\u63a5\u6c60\u83b7\u53d6 TCP \u8fde\u63a5\uff0c\u7ed1\u5b9a\u81f3\u8be5 Proxy \u5bf9\u8c61\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def close(self): ''' \u53d6\u6d88\u8be5 Proxy \u5bf9\u8c61\u7ed1\u5b9a\u7684 TCP \u8fde\u63a5\uff0c\u5f52\u8fd8\u81f3\u8fde\u63a5\u6c60\uff0c\u4e0b\u6b21\u64cd\u4f5c\u524d\u9700\u91cd\u65b0 \u6267\u884c Proxy.connect \u65b9\u6cd5\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def create_cyberdict(self, table_name: str, content: dict = {}): ''' \u521b\u5efa CyberDict \u8868\u3002 \u53c2\u6570: table_name -- \u8868\u540d\u3002 content -- \u8868\u5185\u5bb9\uff0c\u9700\u8981\u662f\u5b57\u5178\u7c7b\u578b\uff0c\u9ed8\u8ba4\u4e3a\u7a7a\u5b57\u5178\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def create_cyberlist(self, table_name: str, content: list = []): ''' \u521b\u5efa CyberList \u8868\u3002 \u53c2\u6570: table_name -- \u8868\u540d\u3002 content -- \u8868\u5185\u5bb9\uff0c\u9700\u8981\u662f\u5217\u8868\u7c7b\u578b\uff0c\u9ed8\u8ba4\u4e3a\u7a7a\u5217\u8868\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def get_cyberdict(self, table_name: str) -> CyberDict: ''' \u83b7\u53d6 CyberDict \u8868\u3002 \u53c2\u6570: table_name -- \u8868\u540d\u3002 \u8fd4\u56de\u7c7b\u578b: CyberDict\uff0c\u8be5\u5bf9\u8c61\u662f Proxy \u751f\u6210\u7684\u5b50\u5bf9\u8c61\uff0c\u7531 Proxy \u63a7\u5236 TCP \u8fde\u63a5\u3002 ''' def get_cyberlist(self, table_name: str) -> CyberList: ''' \u83b7\u53d6 CyberList \u8868\u3002 \u53c2\u6570: table_name -- \u8868\u540d\u3002 \u8fd4\u56de\u7c7b\u578b: CyberList\uff0c\u8be5\u5bf9\u8c61\u662f Proxy \u751f\u6210\u7684\u5b50\u5bf9\u8c61\uff0c\u7531 Proxy \u63a7\u5236 TCP \u8fde\u63a5\u3002 ''' def print_tables(self): ''' \u6253\u5370 CyberDB \u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u8868\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def delete_table(self, table_name: str): ''' \u5220\u9664 CyberDB \u6570\u636e\u5e93\u4e2d\u7684 table_name \u8868\u3002 \u53c2\u6570: table_name -- \u5220\u9664\u7684\u8868\u540d\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' cyberdb.CyberDict \u7c7b class cyberdb.CyberDict \u7531 Proxy \u5bf9\u8c61\u751f\u6210\u7684\u5b50\u5bf9\u8c61\uff0c\u7528\u4e8e\u6267\u884c Dictionaries \u64cd\u4f5c\u3002\u8be5\u5bf9\u8c61\u5c06\u6267\u884c\u8fdc\u7a0b\u64cd\u4f5c\uff0c\u4f5c\u7528\u4e8e\u670d\u52a1\u7aef CyberDB \u6570\u636e\u5e93\u3002\u548c Proxy \u5bf9\u8c61\u5171\u7528\u540c\u4e00\u4e2a TCP \u8fde\u63a5\u3002\u5c06\u8ddf\u968f Proxy \u7684\u8fde\u63a5\u800c\u8fde\u63a5\uff0cProxy \u91ca\u653e\u8fde\u63a5\u540e\uff0c\u8be5\u5bf9\u8c61\u4e5f\u4f1a\u5931\u53bb\u8fde\u63a5\u3002CyberDict \u53ef\u4ee5\u6267\u884c Dictionaries \u7684 get\u3001setdefault\u3001update\u3001keys\u3001values\u3001items\u3001pop\u3001popitem\u3001clear \u65b9\u6cd5\u4ee5\u53ca\u5e38\u7528\u9b54\u672f\u65b9\u6cd5\uff0c\u6b64\u90e8\u5206\u8bf7\u53c2\u8003 Python \u5b57\u5178\u5b98\u65b9\u6587\u6863 \u3002 \u4f7f\u7528 for \u5faa\u73af\u8fed\u4ee3 CyberDict\uff0c\u5ba2\u6237\u7aef\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a o(n), n \u4e3a CyberDict.keys() \u7684\u957f\u5ea6\u3002 def todict(self) -> Dict: ''' \u5c06 CyberDict \u8f6c\u4e3a Dictionaries\u3002 \u8fd4\u56de\u7c7b\u578b: Dict ''' cyberdb.CyberList \u7c7b class cyberdb.CyberList \u7531 Proxy \u5bf9\u8c61\u751f\u6210\u7684\u5b50\u5bf9\u8c61\uff0c\u7528\u4e8e\u6267\u884c Lists \u64cd\u4f5c\u3002\u8be5\u5bf9\u8c61\u5c06\u6267\u884c\u8fdc\u7a0b\u64cd\u4f5c\uff0c\u4f5c\u7528\u4e8e\u670d\u52a1\u7aef CyberDB \u6570\u636e\u5e93\u3002\u548c Proxy \u5bf9\u8c61\u5171\u7528\u540c\u4e00\u4e2a TCP \u8fde\u63a5\u3002\u5c06\u8ddf\u968f Proxy \u7684\u8fde\u63a5\u800c\u8fde\u63a5\uff0cProxy \u91ca\u653e\u8fde\u63a5\u540e\uff0c\u8be5\u5bf9\u8c61\u4e5f\u4f1a\u5931\u53bb\u8fde\u63a5\u3002CyberList \u53ef\u4ee5\u6267\u884c Lists \u7684 append\u3001extend\u3001insert\u3001pop\u3001remove\u3001count\u3001index\u3001reverse\u3001sort\u3001clear \u65b9\u6cd5\u4ee5\u53ca\u5e38\u7528\u9b54\u672f\u65b9\u6cd5\uff0c\u6b64\u90e8\u5206\u8bf7\u53c2\u8003 Python \u5217\u8868\u5b98\u65b9\u6587\u6863 \u3002 \u4f7f\u7528 for \u5faa\u73af\u8fed\u4ee3 CyberList\uff0c\u6bcf\u6b21\u8fed\u4ee3\u5c06\u4ece\u670d\u52a1\u7aef\u83b7\u53d6\u5185\u5bb9\uff0c\u5ba2\u6237\u7aef\u7684\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a o(1)\u3002 def tolist(self) -> List: ''' \u5c06 CyberList \u8f6c\u4e3a Lists\u3002 \u8fd4\u56de\u7c7b\u578b: List '''","title":"API"},{"location":"API/#api","text":"\u8fd9\u90e8\u5206\u6587\u6863\u6db5\u76d6\u4e86 CyberDB \u7684\u6240\u6709\u63a5\u53e3\u3002\u5bf9\u4e8e CyberDB \u4f9d\u8d56\u4e8e\u5916\u90e8\u5e93\u7684\u90e8\u5206\uff0c\u6211\u4eec\u5728\u6b64\u5904\u8bb0\u5f55\u6700\u91cd\u8981\u7684\u90e8\u5206\u5e76\u63d0\u4f9b\u6307\u5411\u89c4\u8303\u6587\u6863\u7684\u94fe\u63a5\u3002","title":"API"},{"location":"API/#cyberdbserver","text":"class cyberdb.Server \u8be5\u7c7b\u7528\u4e8e\u521b\u5efa CyberDB \u670d\u52a1\u7aef\u5bf9\u8c61\u3002 def start(self, host: str = '127.0.0.1', port: int = 9980, password: str = None, max_con: int = 500, timeout: int = 0, print_log: bool = False, encrypt: bool = False): ''' \u540e\u53f0\u542f\u52a8 CyberDB \u670d\u52a1\u5668\uff0c\u8be5\u64cd\u4f5c\u4e0d\u4f1a\u963b\u585e\u524d\u53f0\u4efb\u52a1\u3002 \u53c2\u6570: host -- TCP \u76d1\u542c\u4e3b\u673a\u5730\u5740\uff0c\u5982 127.0.0.1\u3002 port -- TCP \u76d1\u542c\u7aef\u53e3\u3002 password -- TCP \u901a\u4fe1\u5bc6\u7801\uff0c\u5efa\u8bae\u91c7\u7528 \u82f1\u6587\u5b57\u6bcd\u548c\u6570\u5b57\u7684\u7ec4\u5408\u65b9\u5f0f\uff0c \u6700\u957f\u4e0d\u8d85\u8fc7 32 \u4e2a\u5b57\u7b26\u3002 max_con -- \u6700\u5927\u5e76\u53d1\u6570\u3002 timeout -- \u5355\u4e2a\u8fde\u63a5\u7684\u8d85\u65f6\u65f6\u95f4\uff0c\u5355\u4f4d \u79d2\u3002 print_log -- \u662f\u5426\u6253\u5370\u901a\u4fe1\u65e5\u5fd7\uff0cFasle \u4e3a\u4e0d\u6253\u5370\u3002 encrypt -- \u662f\u5426\u52a0\u5bc6\u901a\u4fe1\u5185\u5bb9\uff0cFasle \u4e3a\u4e0d\u52a0\u5bc6\u3002\u6b64\u52a0\u5bc6\u7b97\u6cd5\u4e3a AES-256\uff0c\u5bc6\u94a5\u4e3a password\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def run(self, host: str = '127.0.0.1', port: int = 9980, password: str = None, max_con: int = 500, timeout: int = 0, print_log: bool = False, encrypt: bool = False): ''' \u524d\u53f0\u8fd0\u884c CyberDB \u670d\u52a1\u5668\uff0c\u8be5\u64cd\u4f5c\u4f1a\u963b\u585e\u524d\u53f0\u4efb\u52a1\u3002 \u53c2\u6570\u548c start \u65b9\u6cd5\u76f8\u540c\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def set_ip_whitelist(self, ips: list): ''' \u8bbe\u7f6e ip \u767d\u540d\u5355\uff0cCyberDB \u52a0\u5bc6\u901a\u4fe1\u65f6\u4ec5\u5141\u8bb8\u767d\u540d\u5355\u7684 ip \u8fde\u63a5\uff0c \u8be5\u65b9\u6cd5\u4ec5\u5728 cyberdb.Server.start(encrypt=True) \u6216 cyberdb.Server.run(encrypt=True) \u542f\u7528\u65f6\u6709\u6548\u3002 \u53c2\u6570: ips -- \u7c7b\u578b\u4e3a\u5217\u8868\uff0c\u683c\u5f0f\u5982 ['192.168.1.1', '118.123.89.137'] \u8fd4\u56de\u7c7b\u578b: None ''' def set_backup(self, file_name: str = 'data.cdb', cycle: int = 900): ''' \u8bbe\u7f6e\u5b9a\u65f6\u5907\u4efd\uff0c\u8be5\u64cd\u4f5c\u8bbe\u7f6e\u540e\uff0c\u5c06\u5728\u6307\u5b9a\u5468\u671f\u8fdb\u884c\u6570\u636e\u6301\u4e45\u5316\u5907\u4efd\uff0c\u5c06 CyberDB \u6570\u636e\u5e93\u4fdd\u5b58\u81f3\u786c\u76d8\u3002 \u53c2\u6570: file_name -- \u5907\u4efd\u751f\u6210\u7684\u6587\u4ef6\u540d\uff0c\u6587\u4ef6\u540e\u7f00\u5fc5\u987b\u662f .cdb\u3002 cycle -- \u5faa\u73af\u5907\u4efd\u7684\u5468\u671f\uff0c\u5355\u4f4d \u79d2\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def save_db(self, file_name: str = 'data.cdb'): ''' \u6570\u636e\u6301\u4e45\u5316\uff0c\u5c06 CyberDB \u6570\u636e\u5e93\u4fdd\u5b58\u81f3\u786c\u76d8\u3002 \u53c2\u6570: file_name -- \u5907\u4efd\u751f\u6210\u7684\u6587\u4ef6\u540d\uff0c\u6587\u4ef6\u540e\u7f00\u5fc5\u987b\u662f .cdb\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def load_db(self, file_name: str = 'data.cdb'): ''' \u52a0\u8f7d .cdb \u683c\u5f0f\u7684\u6587\u4ef6\uff0c\u5c06\u786c\u76d8\u4e2d\u5907\u4efd\u7684 CyberDB \u6570\u636e\u5e93\u52a0\u8f7d\u56de\u5185\u5b58\u3002 \u53c2\u6570: file_name -- \u7ecf\u6570\u636e\u6301\u4e45\u5316\u751f\u6210\u7684\u6587\u4ef6\u540d\uff0c\u6587\u4ef6\u540e\u7f00\u5fc5\u987b\u662f .cdb\u3002 \u8fd4\u56de\u7c7b\u578b: None '''","title":"cyberdb.Server \u7c7b"},{"location":"API/#cyberdbconnect","text":"def cyberdb.connect(host: str = '127.0.0.1', port: int = 9980, password: str = None, encrypt: bool = False, time_out: int = None) -> Client: ''' \u5c06\u5ba2\u6237\u7aef\u8fde\u63a5\u81f3 CyberDB \u670d\u52a1\u7aef\u3002 \u53c2\u6570: host -- \u8fde\u63a5\u5730\u5740\uff0c\u5982 127.0.0.1 port -- \u8fde\u63a5\u7aef\u53e3 password -- \u8fde\u63a5\u5bc6\u7801 encrypt -- \u662f\u5426\u52a0\u5bc6\u901a\u4fe1\uff0c\u5982\u679c\u670d\u52a1\u7aef\u542f\u7528 encrypt \u4e3a True\uff0c\u6b64\u5904\u5fc5\u987b\u4e3a True\uff0c\u53cd\u4e4b\u4ea6\u7136\u3002 time_out -- \u8fde\u63a5\u6c60\u4e2d\u6bcf\u4e2a\u8fde\u63a5\u7684\u8d85\u65f6\u65f6\u95f4\uff0c\u5355\u4f4d \u79d2\u3002\u8fde\u63a5\u6c60\u7684\u8fde\u63a5\u7ecf time_out \u79d2\u65e0\u64cd\u4f5c\u5c06\u88ab\u820d\u5f03\uff0c\u4e0b\u6b21\u8fde\u63a5\u5c06\u751f\u6210\u65b0\u8fde\u63a5\u3002\u8fde\u63a5\u6c60\u5c06\u81ea\u52a8\u7ba1\u7406\u8fde\u63a5\uff0c\u5f00\u53d1\u8005\u65e0\u9700\u5173\u6ce8\u7ec6\u8282\u3002 \u6b64\u53c2\u6570\u82e5\u4e3a None\uff0c\u5219\u4e0d\u4f1a\u8d85\u65f6\uff0c\u8fde\u63a5\u6c60\u5c06\u7ef4\u6301\u8fde\u63a5\u76f4\u81f3\u5931\u6548\uff0c\u4e4b\u540e\u5c06\u91cd\u65b0\u751f\u6210\u65b0\u8fde\u63a5\u3002 \u8fd4\u56de\u7c7b\u578b: Client '''","title":"cyberdb.connect \u51fd\u6570"},{"location":"API/#cyberdbclient","text":"class cyberdb.Client cyberdb.connect \u51fd\u6570\u8fd4\u56de\u7684 cyberdb.Client \u5bf9\u8c61\uff0c\u7528\u4e8e\u751f\u6210 Proxy \u5bf9\u8c61\u3002 def get_proxy(self) -> Proxy: ''' \u751f\u6210 Proxy \u5bf9\u8c61\u3002 \u8fd4\u56de\u7c7b\u578b: None '''","title":"cyberdb.Client \u7c7b"},{"location":"API/#proxy","text":"cyberdb.Client.get_proxy \u65b9\u6cd5\u751f\u6210\u7684 Proxy \u5bf9\u8c61\uff0c\u53ef\u5bf9 CyberDB \u6570\u636e\u5e93\u8fdb\u884c\u64cd\u4f5c\uff0c\u5e76\u7ba1\u7406\u7531 Proxy \u751f\u6210\u7684 CyberDict\u3001CyberList \u5b50\u5bf9\u8c61\u7684 TCP \u8fde\u63a5\u3002Proxy \u5bf9\u8c61\u521d\u59cb\u5316\u540e\uff0c\u6267\u884c Proxy.connect \u65b9\u6cd5\u540e\u624d\u80fd\u4f7f\u7528\u3002Proxy \u5bf9\u8c61\u53ca\u5176\u5b50\u5bf9\u8c61\u5c06\u6267\u884c\u8fdc\u7a0b\u64cd\u4f5c\uff0c\u4f5c\u7528\u4e8e\u670d\u52a1\u7aef CyberDB \u6570\u636e\u5e93\u3002 class Proxy def connect(self): ''' \u4ece\u8fde\u63a5\u6c60\u83b7\u53d6 TCP \u8fde\u63a5\uff0c\u7ed1\u5b9a\u81f3\u8be5 Proxy \u5bf9\u8c61\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def close(self): ''' \u53d6\u6d88\u8be5 Proxy \u5bf9\u8c61\u7ed1\u5b9a\u7684 TCP \u8fde\u63a5\uff0c\u5f52\u8fd8\u81f3\u8fde\u63a5\u6c60\uff0c\u4e0b\u6b21\u64cd\u4f5c\u524d\u9700\u91cd\u65b0 \u6267\u884c Proxy.connect \u65b9\u6cd5\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def create_cyberdict(self, table_name: str, content: dict = {}): ''' \u521b\u5efa CyberDict \u8868\u3002 \u53c2\u6570: table_name -- \u8868\u540d\u3002 content -- \u8868\u5185\u5bb9\uff0c\u9700\u8981\u662f\u5b57\u5178\u7c7b\u578b\uff0c\u9ed8\u8ba4\u4e3a\u7a7a\u5b57\u5178\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def create_cyberlist(self, table_name: str, content: list = []): ''' \u521b\u5efa CyberList \u8868\u3002 \u53c2\u6570: table_name -- \u8868\u540d\u3002 content -- \u8868\u5185\u5bb9\uff0c\u9700\u8981\u662f\u5217\u8868\u7c7b\u578b\uff0c\u9ed8\u8ba4\u4e3a\u7a7a\u5217\u8868\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def get_cyberdict(self, table_name: str) -> CyberDict: ''' \u83b7\u53d6 CyberDict \u8868\u3002 \u53c2\u6570: table_name -- \u8868\u540d\u3002 \u8fd4\u56de\u7c7b\u578b: CyberDict\uff0c\u8be5\u5bf9\u8c61\u662f Proxy \u751f\u6210\u7684\u5b50\u5bf9\u8c61\uff0c\u7531 Proxy \u63a7\u5236 TCP \u8fde\u63a5\u3002 ''' def get_cyberlist(self, table_name: str) -> CyberList: ''' \u83b7\u53d6 CyberList \u8868\u3002 \u53c2\u6570: table_name -- \u8868\u540d\u3002 \u8fd4\u56de\u7c7b\u578b: CyberList\uff0c\u8be5\u5bf9\u8c61\u662f Proxy \u751f\u6210\u7684\u5b50\u5bf9\u8c61\uff0c\u7531 Proxy \u63a7\u5236 TCP \u8fde\u63a5\u3002 ''' def print_tables(self): ''' \u6253\u5370 CyberDB \u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u8868\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def delete_table(self, table_name: str): ''' \u5220\u9664 CyberDB \u6570\u636e\u5e93\u4e2d\u7684 table_name \u8868\u3002 \u53c2\u6570: table_name -- \u5220\u9664\u7684\u8868\u540d\u3002 \u8fd4\u56de\u7c7b\u578b: None '''","title":"Proxy \u7c7b"},{"location":"API/#cyberdbcyberdict","text":"class cyberdb.CyberDict \u7531 Proxy \u5bf9\u8c61\u751f\u6210\u7684\u5b50\u5bf9\u8c61\uff0c\u7528\u4e8e\u6267\u884c Dictionaries \u64cd\u4f5c\u3002\u8be5\u5bf9\u8c61\u5c06\u6267\u884c\u8fdc\u7a0b\u64cd\u4f5c\uff0c\u4f5c\u7528\u4e8e\u670d\u52a1\u7aef CyberDB \u6570\u636e\u5e93\u3002\u548c Proxy \u5bf9\u8c61\u5171\u7528\u540c\u4e00\u4e2a TCP \u8fde\u63a5\u3002\u5c06\u8ddf\u968f Proxy \u7684\u8fde\u63a5\u800c\u8fde\u63a5\uff0cProxy \u91ca\u653e\u8fde\u63a5\u540e\uff0c\u8be5\u5bf9\u8c61\u4e5f\u4f1a\u5931\u53bb\u8fde\u63a5\u3002CyberDict \u53ef\u4ee5\u6267\u884c Dictionaries \u7684 get\u3001setdefault\u3001update\u3001keys\u3001values\u3001items\u3001pop\u3001popitem\u3001clear \u65b9\u6cd5\u4ee5\u53ca\u5e38\u7528\u9b54\u672f\u65b9\u6cd5\uff0c\u6b64\u90e8\u5206\u8bf7\u53c2\u8003 Python \u5b57\u5178\u5b98\u65b9\u6587\u6863 \u3002 \u4f7f\u7528 for \u5faa\u73af\u8fed\u4ee3 CyberDict\uff0c\u5ba2\u6237\u7aef\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a o(n), n \u4e3a CyberDict.keys() \u7684\u957f\u5ea6\u3002 def todict(self) -> Dict: ''' \u5c06 CyberDict \u8f6c\u4e3a Dictionaries\u3002 \u8fd4\u56de\u7c7b\u578b: Dict '''","title":"cyberdb.CyberDict \u7c7b"},{"location":"API/#cyberdbcyberlist","text":"class cyberdb.CyberList \u7531 Proxy \u5bf9\u8c61\u751f\u6210\u7684\u5b50\u5bf9\u8c61\uff0c\u7528\u4e8e\u6267\u884c Lists \u64cd\u4f5c\u3002\u8be5\u5bf9\u8c61\u5c06\u6267\u884c\u8fdc\u7a0b\u64cd\u4f5c\uff0c\u4f5c\u7528\u4e8e\u670d\u52a1\u7aef CyberDB \u6570\u636e\u5e93\u3002\u548c Proxy \u5bf9\u8c61\u5171\u7528\u540c\u4e00\u4e2a TCP \u8fde\u63a5\u3002\u5c06\u8ddf\u968f Proxy \u7684\u8fde\u63a5\u800c\u8fde\u63a5\uff0cProxy \u91ca\u653e\u8fde\u63a5\u540e\uff0c\u8be5\u5bf9\u8c61\u4e5f\u4f1a\u5931\u53bb\u8fde\u63a5\u3002CyberList \u53ef\u4ee5\u6267\u884c Lists \u7684 append\u3001extend\u3001insert\u3001pop\u3001remove\u3001count\u3001index\u3001reverse\u3001sort\u3001clear \u65b9\u6cd5\u4ee5\u53ca\u5e38\u7528\u9b54\u672f\u65b9\u6cd5\uff0c\u6b64\u90e8\u5206\u8bf7\u53c2\u8003 Python \u5217\u8868\u5b98\u65b9\u6587\u6863 \u3002 \u4f7f\u7528 for \u5faa\u73af\u8fed\u4ee3 CyberList\uff0c\u6bcf\u6b21\u8fed\u4ee3\u5c06\u4ece\u670d\u52a1\u7aef\u83b7\u53d6\u5185\u5bb9\uff0c\u5ba2\u6237\u7aef\u7684\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a o(1)\u3002 def tolist(self) -> List: ''' \u5c06 CyberList \u8f6c\u4e3a Lists\u3002 \u8fd4\u56de\u7c7b\u578b: List '''","title":"cyberdb.CyberList \u7c7b"}]}
\ No newline at end of file
+{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"CyberDB CyberDB \u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684 Python \u5185\u5b58\u6570\u636e\u5e93\u3002\u5b83\u65e8\u5728\u5229\u7528 Python \u5185\u7f6e\u6570\u636e\u7ed3\u6784 Dictionaries\u3001Lists \u4f5c\u6570\u636e\u5b58\u50a8\uff0c\u901a\u8fc7 Socket TCP \u9ad8\u6548\u901a\u4fe1\uff0c\u5e76\u63d0\u4f9b\u6570\u636e\u6301\u4e45\u5316\u3002\u8be5\u6a21\u5757\u5e38\u7528\u4e8e Gunicorn \u8fdb\u7a0b\u95f4\u901a\u4fe1\u3001\u5206\u5e03\u5f0f\u8ba1\u7b97 \u7b49\u9886\u57df\u3002 \u5b89\u88c5\u65b9\u6cd5 1.\u8fdb\u5165\u547d\u4ee4\u7a97\u53e3\uff0c\u521b\u5efa\u865a\u62df\u73af\u5883\uff0c\u4f9d\u6b21\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4 Linux \u548c macOS: python3 -m venv venv # \u521b\u5efa\u865a\u62df\u73af\u5883 . venv/bin/activate # \u6fc0\u6d3b\u865a\u62df\u73af\u5883 Windows: python -m venv venv # \u521b\u5efa\u865a\u62df\u73af\u5883 venv\\Scripts\\activate # \u6fc0\u6d3b\u865a\u62df\u73af\u5883 2.\u5b89\u88c5 CyberDB\uff0c\u4f9d\u6b21\u8f93\u5165 pip install --upgrade pip pip install cyberdb \u5982\u679c\u4f60\u7684\u670d\u52a1\u7aef\u548c\u5ba2\u6237\u7aef\u5728\u4e24\u4e2a\u4e0d\u540c\u7684\u9879\u76ee\u76ee\u5f55\u8fd0\u884c\uff0c\u8bf7\u5206\u522b\u5728\u670d\u52a1\u7aef\u3001\u5ba2\u6237\u7aef\u7684\u865a\u62df\u73af\u5883\u4e2d\u5b89\u88c5 CyberDB\u3002 \u94fe\u63a5 GitHub: https://github.com/Cyberbolt/CyberDB PyPI: https://pypi.org/project/CyberDB/ \u6587\u6863: https://www.cyberlight.xyz/static/cyberdb-chn \u7535\u5149\u7b14\u8bb0: https://www.cyberlight.xyz/ \u5feb\u901f\u4f7f\u7528 \u8be5\u6a21\u5757\u4e2d\u8bf7\u4f7f\u7528 CyberDict \u548c CyberList \u66ff\u4ee3 dict \u548c list \uff08\u4e00\u79cd\u57fa\u4e8e TCP \u7684\u7c7b Dictionaries\u3001\u7c7b Lists \u5bf9\u8c61\uff09\u3002 \u670d\u52a1\u7aef \u670d\u52a1\u7aef\u521d\u59cb\u5316\uff0c\u8bbe\u7f6e\u5907\u4efd\u548c TCP \u76d1\u542c\u5730\u5740\u3002 import time import cyberdb db = cyberdb.Server() # \u6570\u636e\u6301\u4e45\u5316\uff0c\u5907\u4efd\u6587\u4ef6\u4e3a data.cdb\uff0c\u5907\u4efd\u5468\u671f 900 \u79d2\u4e00\u6b21\u3002 db.set_backup('data.cdb', cycle=900) # \u8bbe\u7f6e TCP \u5730\u5740\u3001\u7aef\u53e3\u53f7\u3001\u5bc6\u7801\uff0c\u751f\u4ea7\u73af\u5883\u4e2d\u5bc6\u7801\u5efa\u8bae\u4f7f\u7528\u5927\u5c0f\u5199\u5b57\u6bcd\u548c\u6570\u5b57\u7684\u7ec4\u5408\u3002 # start \u65b9\u6cd5\u4e0d\u4f1a\u963b\u585e\u8fd0\u884c\uff0c\u82e5\u5e0c\u671b\u8be5\u64cd\u4f5c\u963b\u585e\uff0c\u8bf7\u4f7f\u7528 run \u65b9\u6cd5\u4ee3\u66ff start\uff0c\u53c2\u6570\u4e0d\u53d8\u3002 db.start(host='127.0.0.1', port=9980, password='123456') while True: time.sleep(10000) \u4e0a\u8ff0\u670d\u52a1\u7aef\u8fd0\u884c\u540e\uff0c\u6bcf 900 \u79d2\u5c06\u5728\u6b64\u9879\u76ee\u6839\u76ee\u5f55\u751f\u6210\uff08\u6216\u8986\u76d6\uff09data.cdb\u3002\u4e0b\u6b21\u542f\u52a8\u6570\u636e\u5e93\u53ef\u4f7f\u7528 load \u65b9\u6cd5\u8bfb\u53d6\u8be5\u6587\u4ef6\u3002 \u5ba2\u6237\u7aef \u8fde\u63a5\u6570\u636e\u5e93 import cyberdb # \u751f\u6210\u5ba2\u6237\u7aef\u5b9e\u4f8b\u5e76\u8fde\u63a5\u3002 client = cyberdb.connect(host='127.0.0.1', port=9980, password='123456') \u751f\u6210 proxy \u5bf9\u8c61 # \u751f\u6210\u672c\u6b21\u8bf7\u6c42\u7684 proxy\u3002 proxy = client.get_proxy() # \u4ece\u8fde\u63a5\u6c60\u81ea\u52a8\u83b7\u53d6\u6570\u636e\u5e93\u8fde\u63a5\u3002 proxy.connect() \u5efa\u8bae\u5728\u6bcf\u4e2a\u7ebf\u7a0b(\u6216\u534f\u7a0b)\u4e2d\u5355\u72ec\u751f\u6210 proxy \u5bf9\u8c61\uff0c\u5e76\u901a\u8fc7 connect \u65b9\u6cd5\u83b7\u53d6\u6570\u636e\u5e93\u8fde\u63a5\u3002\u4f60\u53ea\u9700\u5728\u64cd\u4f5c\u5b8c\u6210\u540e\u4f7f\u7528 close \u65b9\u6cd5\u5f52\u8fd8\u8fde\u63a5\u5373\u53ef\uff0c\u5f52\u8fd8\u540e\u7684\u8fde\u63a5\u7531 client \u5bf9\u8c61\u667a\u80fd\u7ba1\u7406\u3002 \u64cd\u4f5c proxy \u5bf9\u8c61 \u521b\u5efa CyberDict \u548c CyberList # \u5728\u6570\u636e\u5e93\u4e2d\u5206\u522b\u521b\u5efa\u7c7b\u578b\u4e3a CyberDict \u7684 dict1\u3001dict2 \u8868\uff0c # \u7c7b\u578b\u4e3a CyberList \u7684 list1 \u8868\u3002 proxy.create_cyberdict('dict1') proxy.create_cyberdict('dict2') proxy.create_cyberlist('list1') dict1 = proxy.get_cyberdict('dict1') dict2 = proxy.get_cyberdict('dict2') list1 = proxy.get_cyberlist('list1') \u6b64\u5904\u83b7\u53d6\u7684 dict1\u3001dict2\u3001list1 \u5747\u4e3a\u7f51\u7edc\u5bf9\u8c61\uff0c\u6570\u636e\u901a\u8fc7 TCP \u4f20\u8f93\u3002\u4e09\u4e2a\u5bf9\u8c61\u53d7 proxy \u63a7\u5236\uff0c\u5f53\u8c03\u7528 proxy.close() \u5f52\u8fd8\u8fde\u63a5\u540e\uff0c\u4e09\u4e2a\u5bf9\u8c61\u4e5f\u4f1a\u5931\u6548\u3002\u540c\u6837\uff0c\u4f7f\u7528 proxy.connect() \u53ef\u91cd\u65b0\u4ece\u8fde\u63a5\u6c60\u83b7\u53d6\u8fde\u63a5\uff0cdict1\u3001dict2\u3001list1 \u4e5f\u53d8\u4e3a\u53ef\u7528\u3002 \u4e86\u89e3\u6b64\u64cd\u4f5c\u540e\uff0c\u4f60\u4fbf\u53ef\u4ee5\u50cf\u64cd\u4f5c Dictionaries \u4e00\u6837\u64cd\u4f5c dict1\u3001dict2\uff0c\u50cf\u64cd\u4f5c Lists \u4e00\u6837\u64cd\u4f5c list1 \u4e86\uff01\uff08CyberDict \u548c CyberList \u652f\u6301 Dictionaries\u3001Lists \u7684\u5927\u90e8\u5206\u65b9\u6cd5\uff09 \u793a\u4f8b\u5982\u4e0b CyberDict \u5e38\u7528\u64cd\u4f5c \u5728 dict1 \u548c dict2 \u4e2d\u65b0\u589e\u952e\u503c\u5bf9 dict1[0] = 100 dict1['test'] = 'Hello CyberDB!' dict2[0] = 200 \u83b7\u53d6\u5bf9\u5e94\u7684\u503c dict1.get(0) 100 dict2[0] 200 \u67e5\u770b dict1 \u548c dict2 (\u4e5f\u53ef\u4ee5\u4f7f\u7528 print \u6253\u5370) dict1 {0: 100, 'test': 'Hello CyberDB!'} dict2 {0: 200} \u83b7\u53d6\u957f\u5ea6 len(dict1) 2 \u5220\u9664\u952e\u503c\u5bf9 del dict1[0] dict1 {'test': 'Hello CyberDB!'} \u6e05\u7a7a dict1 dict1.clear() dict1 {} CyberList \u5e38\u7528\u64cd\u4f5c \u751f\u6210 list1 \u7684\u5185\u5bb9 for i in range(5): list1.append(99) list1 [99, 99, 99, 99, 99] \u66f4\u6539\u5750\u6807\u503c list1[3] = 100 list1 [99, 99, 99, 100, 99] \u8fdb\u884c\u5207\u7247 list1[3:] [100, 99] \u83b7\u53d6 list1 \u7684\u957f\u5ea6 len(list1) 5 \u901a\u8fc7\u8fed\u4ee3\u6253\u5370 list1 \u6bcf\u4e2a\u5143\u7d20 for v in list1: print(v) 99 99 99 100 99 \u5f3a\u70c8\u63a8\u8350\u4f7f\u7528 for \u5faa\u73af\u8fed\u4ee3 CyberList\uff0c\u6bcf\u6b21\u8fed\u4ee3\u5c06\u4ece\u670d\u52a1\u7aef\u83b7\u53d6 v\uff0c\u5ba2\u6237\u7aef\u7684\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a o(1)\u3002\u8fed\u4ee3\u540c\u6837\u53ef\u7528\u4e8e CyberDict\uff0cCyberDict \u7684\u8fed\u4ee3\u4e2d\uff0c\u5ba2\u6237\u7aef\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a o(n), n \u4e3a CyberDict.keys() \u7684\u957f\u5ea6\u3002 \u91ca\u653e proxy \u5bf9\u8c61 \u4f7f\u7528\u5b8c\u6210\uff0c\u5c06 proxy \u7684\u8fde\u63a5\u5f52\u8fd8\u81f3\u8fde\u63a5\u6c60\u5373\u53ef\u3002 proxy.close() proxy \u5bf9\u8c61\u540c\u6837\u652f\u6301\u4e0a\u4e0b\u6587\u7ba1\u7406\u5668\uff0c\u5982 with client.get_proxy() as proxy: list1 = proxy.get_cyberlist('list1') print(list1) [99, 99, 99, 100, 99] \u6982\u62ec \u6709\u4e86 CyberDB\uff0c\u4fbf\u80fd\u5145\u5206\u5229\u7528\u5185\u5b58\u6027\u80fd\uff0c\u4e0d\u540c\u8fdb\u7a0b(\u751a\u81f3\u4e0d\u540c\u4e3b\u673a)\u80fd\u901a\u8fc7 Python \u7684\u6570\u636e\u7ed3\u6784\u901a\u4fe1\u3002\u611f\u8c22\u4f60\u7684\u652f\u6301\uff01 \u6ce8\u610f \u7531\u4e8e\u7f16\u7801\u9650\u5236\uff0cCyberDB \u4f1a\u5c06 0 \u8bc6\u522b\u4e3a None\uff0c\u4f46\u5e76\u4e0d\u5f71\u54cd\u8ba1\u7b97\uff0c\u8bf7\u5728\u6240\u9700\u4f4d\u7f6e\u5c06 None \u8f6c\u4e3a 0\u3002","title":"\u4e3b\u9875"},{"location":"#cyberdb","text":"CyberDB \u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684 Python \u5185\u5b58\u6570\u636e\u5e93\u3002\u5b83\u65e8\u5728\u5229\u7528 Python \u5185\u7f6e\u6570\u636e\u7ed3\u6784 Dictionaries\u3001Lists \u4f5c\u6570\u636e\u5b58\u50a8\uff0c\u901a\u8fc7 Socket TCP \u9ad8\u6548\u901a\u4fe1\uff0c\u5e76\u63d0\u4f9b\u6570\u636e\u6301\u4e45\u5316\u3002\u8be5\u6a21\u5757\u5e38\u7528\u4e8e Gunicorn \u8fdb\u7a0b\u95f4\u901a\u4fe1\u3001\u5206\u5e03\u5f0f\u8ba1\u7b97 \u7b49\u9886\u57df\u3002","title":"CyberDB"},{"location":"#_1","text":"1.\u8fdb\u5165\u547d\u4ee4\u7a97\u53e3\uff0c\u521b\u5efa\u865a\u62df\u73af\u5883\uff0c\u4f9d\u6b21\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4 Linux \u548c macOS: python3 -m venv venv # \u521b\u5efa\u865a\u62df\u73af\u5883 . venv/bin/activate # \u6fc0\u6d3b\u865a\u62df\u73af\u5883 Windows: python -m venv venv # \u521b\u5efa\u865a\u62df\u73af\u5883 venv\\Scripts\\activate # \u6fc0\u6d3b\u865a\u62df\u73af\u5883 2.\u5b89\u88c5 CyberDB\uff0c\u4f9d\u6b21\u8f93\u5165 pip install --upgrade pip pip install cyberdb \u5982\u679c\u4f60\u7684\u670d\u52a1\u7aef\u548c\u5ba2\u6237\u7aef\u5728\u4e24\u4e2a\u4e0d\u540c\u7684\u9879\u76ee\u76ee\u5f55\u8fd0\u884c\uff0c\u8bf7\u5206\u522b\u5728\u670d\u52a1\u7aef\u3001\u5ba2\u6237\u7aef\u7684\u865a\u62df\u73af\u5883\u4e2d\u5b89\u88c5 CyberDB\u3002","title":"\u5b89\u88c5\u65b9\u6cd5"},{"location":"#_2","text":"GitHub: https://github.com/Cyberbolt/CyberDB PyPI: https://pypi.org/project/CyberDB/ \u6587\u6863: https://www.cyberlight.xyz/static/cyberdb-chn \u7535\u5149\u7b14\u8bb0: https://www.cyberlight.xyz/","title":"\u94fe\u63a5"},{"location":"#_3","text":"\u8be5\u6a21\u5757\u4e2d\u8bf7\u4f7f\u7528 CyberDict \u548c CyberList \u66ff\u4ee3 dict \u548c list \uff08\u4e00\u79cd\u57fa\u4e8e TCP \u7684\u7c7b Dictionaries\u3001\u7c7b Lists \u5bf9\u8c61\uff09\u3002","title":"\u5feb\u901f\u4f7f\u7528"},{"location":"#_4","text":"\u670d\u52a1\u7aef\u521d\u59cb\u5316\uff0c\u8bbe\u7f6e\u5907\u4efd\u548c TCP \u76d1\u542c\u5730\u5740\u3002 import time import cyberdb db = cyberdb.Server() # \u6570\u636e\u6301\u4e45\u5316\uff0c\u5907\u4efd\u6587\u4ef6\u4e3a data.cdb\uff0c\u5907\u4efd\u5468\u671f 900 \u79d2\u4e00\u6b21\u3002 db.set_backup('data.cdb', cycle=900) # \u8bbe\u7f6e TCP \u5730\u5740\u3001\u7aef\u53e3\u53f7\u3001\u5bc6\u7801\uff0c\u751f\u4ea7\u73af\u5883\u4e2d\u5bc6\u7801\u5efa\u8bae\u4f7f\u7528\u5927\u5c0f\u5199\u5b57\u6bcd\u548c\u6570\u5b57\u7684\u7ec4\u5408\u3002 # start \u65b9\u6cd5\u4e0d\u4f1a\u963b\u585e\u8fd0\u884c\uff0c\u82e5\u5e0c\u671b\u8be5\u64cd\u4f5c\u963b\u585e\uff0c\u8bf7\u4f7f\u7528 run \u65b9\u6cd5\u4ee3\u66ff start\uff0c\u53c2\u6570\u4e0d\u53d8\u3002 db.start(host='127.0.0.1', port=9980, password='123456') while True: time.sleep(10000) \u4e0a\u8ff0\u670d\u52a1\u7aef\u8fd0\u884c\u540e\uff0c\u6bcf 900 \u79d2\u5c06\u5728\u6b64\u9879\u76ee\u6839\u76ee\u5f55\u751f\u6210\uff08\u6216\u8986\u76d6\uff09data.cdb\u3002\u4e0b\u6b21\u542f\u52a8\u6570\u636e\u5e93\u53ef\u4f7f\u7528 load \u65b9\u6cd5\u8bfb\u53d6\u8be5\u6587\u4ef6\u3002","title":"\u670d\u52a1\u7aef"},{"location":"#_5","text":"","title":"\u5ba2\u6237\u7aef"},{"location":"#_6","text":"import cyberdb # \u751f\u6210\u5ba2\u6237\u7aef\u5b9e\u4f8b\u5e76\u8fde\u63a5\u3002 client = cyberdb.connect(host='127.0.0.1', port=9980, password='123456')","title":"\u8fde\u63a5\u6570\u636e\u5e93"},{"location":"#proxy","text":"# \u751f\u6210\u672c\u6b21\u8bf7\u6c42\u7684 proxy\u3002 proxy = client.get_proxy() # \u4ece\u8fde\u63a5\u6c60\u81ea\u52a8\u83b7\u53d6\u6570\u636e\u5e93\u8fde\u63a5\u3002 proxy.connect() \u5efa\u8bae\u5728\u6bcf\u4e2a\u7ebf\u7a0b(\u6216\u534f\u7a0b)\u4e2d\u5355\u72ec\u751f\u6210 proxy \u5bf9\u8c61\uff0c\u5e76\u901a\u8fc7 connect \u65b9\u6cd5\u83b7\u53d6\u6570\u636e\u5e93\u8fde\u63a5\u3002\u4f60\u53ea\u9700\u5728\u64cd\u4f5c\u5b8c\u6210\u540e\u4f7f\u7528 close \u65b9\u6cd5\u5f52\u8fd8\u8fde\u63a5\u5373\u53ef\uff0c\u5f52\u8fd8\u540e\u7684\u8fde\u63a5\u7531 client \u5bf9\u8c61\u667a\u80fd\u7ba1\u7406\u3002","title":"\u751f\u6210 proxy \u5bf9\u8c61"},{"location":"#proxy_1","text":"\u521b\u5efa CyberDict \u548c CyberList # \u5728\u6570\u636e\u5e93\u4e2d\u5206\u522b\u521b\u5efa\u7c7b\u578b\u4e3a CyberDict \u7684 dict1\u3001dict2 \u8868\uff0c # \u7c7b\u578b\u4e3a CyberList \u7684 list1 \u8868\u3002 proxy.create_cyberdict('dict1') proxy.create_cyberdict('dict2') proxy.create_cyberlist('list1') dict1 = proxy.get_cyberdict('dict1') dict2 = proxy.get_cyberdict('dict2') list1 = proxy.get_cyberlist('list1') \u6b64\u5904\u83b7\u53d6\u7684 dict1\u3001dict2\u3001list1 \u5747\u4e3a\u7f51\u7edc\u5bf9\u8c61\uff0c\u6570\u636e\u901a\u8fc7 TCP \u4f20\u8f93\u3002\u4e09\u4e2a\u5bf9\u8c61\u53d7 proxy \u63a7\u5236\uff0c\u5f53\u8c03\u7528 proxy.close() \u5f52\u8fd8\u8fde\u63a5\u540e\uff0c\u4e09\u4e2a\u5bf9\u8c61\u4e5f\u4f1a\u5931\u6548\u3002\u540c\u6837\uff0c\u4f7f\u7528 proxy.connect() \u53ef\u91cd\u65b0\u4ece\u8fde\u63a5\u6c60\u83b7\u53d6\u8fde\u63a5\uff0cdict1\u3001dict2\u3001list1 \u4e5f\u53d8\u4e3a\u53ef\u7528\u3002 \u4e86\u89e3\u6b64\u64cd\u4f5c\u540e\uff0c\u4f60\u4fbf\u53ef\u4ee5\u50cf\u64cd\u4f5c Dictionaries \u4e00\u6837\u64cd\u4f5c dict1\u3001dict2\uff0c\u50cf\u64cd\u4f5c Lists \u4e00\u6837\u64cd\u4f5c list1 \u4e86\uff01\uff08CyberDict \u548c CyberList \u652f\u6301 Dictionaries\u3001Lists \u7684\u5927\u90e8\u5206\u65b9\u6cd5\uff09 \u793a\u4f8b\u5982\u4e0b","title":"\u64cd\u4f5c proxy \u5bf9\u8c61"},{"location":"#cyberdict","text":"\u5728 dict1 \u548c dict2 \u4e2d\u65b0\u589e\u952e\u503c\u5bf9 dict1[0] = 100 dict1['test'] = 'Hello CyberDB!' dict2[0] = 200 \u83b7\u53d6\u5bf9\u5e94\u7684\u503c dict1.get(0) 100 dict2[0] 200 \u67e5\u770b dict1 \u548c dict2 (\u4e5f\u53ef\u4ee5\u4f7f\u7528 print \u6253\u5370) dict1 {0: 100, 'test': 'Hello CyberDB!'} dict2 {0: 200} \u83b7\u53d6\u957f\u5ea6 len(dict1) 2 \u5220\u9664\u952e\u503c\u5bf9 del dict1[0] dict1 {'test': 'Hello CyberDB!'} \u6e05\u7a7a dict1 dict1.clear() dict1 {}","title":"CyberDict \u5e38\u7528\u64cd\u4f5c"},{"location":"#cyberlist","text":"\u751f\u6210 list1 \u7684\u5185\u5bb9 for i in range(5): list1.append(99) list1 [99, 99, 99, 99, 99] \u66f4\u6539\u5750\u6807\u503c list1[3] = 100 list1 [99, 99, 99, 100, 99] \u8fdb\u884c\u5207\u7247 list1[3:] [100, 99] \u83b7\u53d6 list1 \u7684\u957f\u5ea6 len(list1) 5 \u901a\u8fc7\u8fed\u4ee3\u6253\u5370 list1 \u6bcf\u4e2a\u5143\u7d20 for v in list1: print(v) 99 99 99 100 99 \u5f3a\u70c8\u63a8\u8350\u4f7f\u7528 for \u5faa\u73af\u8fed\u4ee3 CyberList\uff0c\u6bcf\u6b21\u8fed\u4ee3\u5c06\u4ece\u670d\u52a1\u7aef\u83b7\u53d6 v\uff0c\u5ba2\u6237\u7aef\u7684\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a o(1)\u3002\u8fed\u4ee3\u540c\u6837\u53ef\u7528\u4e8e CyberDict\uff0cCyberDict \u7684\u8fed\u4ee3\u4e2d\uff0c\u5ba2\u6237\u7aef\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a o(n), n \u4e3a CyberDict.keys() \u7684\u957f\u5ea6\u3002","title":"CyberList \u5e38\u7528\u64cd\u4f5c"},{"location":"#proxy_2","text":"\u4f7f\u7528\u5b8c\u6210\uff0c\u5c06 proxy \u7684\u8fde\u63a5\u5f52\u8fd8\u81f3\u8fde\u63a5\u6c60\u5373\u53ef\u3002 proxy.close() proxy \u5bf9\u8c61\u540c\u6837\u652f\u6301\u4e0a\u4e0b\u6587\u7ba1\u7406\u5668\uff0c\u5982 with client.get_proxy() as proxy: list1 = proxy.get_cyberlist('list1') print(list1) [99, 99, 99, 100, 99]","title":"\u91ca\u653e proxy \u5bf9\u8c61"},{"location":"#_7","text":"\u6709\u4e86 CyberDB\uff0c\u4fbf\u80fd\u5145\u5206\u5229\u7528\u5185\u5b58\u6027\u80fd\uff0c\u4e0d\u540c\u8fdb\u7a0b(\u751a\u81f3\u4e0d\u540c\u4e3b\u673a)\u80fd\u901a\u8fc7 Python \u7684\u6570\u636e\u7ed3\u6784\u901a\u4fe1\u3002\u611f\u8c22\u4f60\u7684\u652f\u6301\uff01","title":"\u6982\u62ec"},{"location":"#_8","text":"\u7531\u4e8e\u7f16\u7801\u9650\u5236\uff0cCyberDB \u4f1a\u5c06 0 \u8bc6\u522b\u4e3a None\uff0c\u4f46\u5e76\u4e0d\u5f71\u54cd\u8ba1\u7b97\uff0c\u8bf7\u5728\u6240\u9700\u4f4d\u7f6e\u5c06 None \u8f6c\u4e3a 0\u3002","title":"\u6ce8\u610f"},{"location":"API/","text":"API \u8fd9\u90e8\u5206\u6587\u6863\u6db5\u76d6\u4e86 CyberDB \u7684\u6240\u6709\u63a5\u53e3\u3002\u5bf9\u4e8e CyberDB \u4f9d\u8d56\u4e8e\u5916\u90e8\u5e93\u7684\u90e8\u5206\uff0c\u6211\u4eec\u5728\u6b64\u5904\u8bb0\u5f55\u6700\u91cd\u8981\u7684\u90e8\u5206\u5e76\u63d0\u4f9b\u6307\u5411\u89c4\u8303\u6587\u6863\u7684\u94fe\u63a5\u3002 cyberdb.Server \u7c7b class cyberdb.Server \u8be5\u7c7b\u7528\u4e8e\u521b\u5efa CyberDB \u670d\u52a1\u7aef\u5bf9\u8c61\u3002 def start(self, host: str = '127.0.0.1', port: int = 9980, password: str = None, max_con: int = 500, timeout: int = 0, print_log: bool = False, encrypt: bool = False): ''' \u540e\u53f0\u542f\u52a8 CyberDB \u670d\u52a1\u5668\uff0c\u8be5\u64cd\u4f5c\u4e0d\u4f1a\u963b\u585e\u524d\u53f0\u4efb\u52a1\u3002 \u53c2\u6570: host -- TCP \u76d1\u542c\u4e3b\u673a\u5730\u5740\uff0c\u5982 127.0.0.1\u3002 port -- TCP \u76d1\u542c\u7aef\u53e3\u3002 password -- TCP \u901a\u4fe1\u5bc6\u7801\uff0c\u5efa\u8bae\u91c7\u7528 \u82f1\u6587\u5b57\u6bcd\u548c\u6570\u5b57\u7684\u7ec4\u5408\u65b9\u5f0f\uff0c \u6700\u957f\u4e0d\u8d85\u8fc7 32 \u4e2a\u5b57\u7b26\u3002 max_con -- \u6700\u5927\u5e76\u53d1\u6570\u3002 timeout -- \u5355\u4e2a\u8fde\u63a5\u7684\u8d85\u65f6\u65f6\u95f4\uff0c\u5355\u4f4d \u79d2\u3002 print_log -- \u662f\u5426\u6253\u5370\u901a\u4fe1\u65e5\u5fd7\uff0cFasle \u4e3a\u4e0d\u6253\u5370\u3002 encrypt -- \u662f\u5426\u52a0\u5bc6\u901a\u4fe1\u5185\u5bb9\uff0cFasle \u4e3a\u4e0d\u52a0\u5bc6\u3002\u6b64\u52a0\u5bc6\u7b97\u6cd5\u4e3a AES-256\uff0c\u5bc6\u94a5\u4e3a password\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def run(self, host: str = '127.0.0.1', port: int = 9980, password: str = None, max_con: int = 500, timeout: int = 0, print_log: bool = False, encrypt: bool = False): ''' \u524d\u53f0\u8fd0\u884c CyberDB \u670d\u52a1\u5668\uff0c\u8be5\u64cd\u4f5c\u4f1a\u963b\u585e\u524d\u53f0\u4efb\u52a1\u3002 \u53c2\u6570\u548c start \u65b9\u6cd5\u76f8\u540c\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def set_ip_whitelist(self, ips: list): ''' \u8bbe\u7f6e ip \u767d\u540d\u5355\uff0cCyberDB \u52a0\u5bc6\u901a\u4fe1\u65f6\u4ec5\u5141\u8bb8\u767d\u540d\u5355\u7684 ip \u8fde\u63a5\uff0c \u8be5\u65b9\u6cd5\u4ec5\u5728 cyberdb.Server.start(encrypt=True) \u6216 cyberdb.Server.run(encrypt=True) \u542f\u7528\u65f6\u6709\u6548\u3002 \u53c2\u6570: ips -- \u7c7b\u578b\u4e3a\u5217\u8868\uff0c\u683c\u5f0f\u5982 ['192.168.1.1', '118.123.89.137'] \u8fd4\u56de\u7c7b\u578b: None ''' def set_backup(self, file_name: str = 'data.cdb', cycle: int = 900): ''' \u8bbe\u7f6e\u5b9a\u65f6\u5907\u4efd\uff0c\u8be5\u64cd\u4f5c\u8bbe\u7f6e\u540e\uff0c\u5c06\u5728\u6307\u5b9a\u5468\u671f\u8fdb\u884c\u6570\u636e\u6301\u4e45\u5316\u5907\u4efd\uff0c\u5c06 CyberDB \u6570\u636e\u5e93\u4fdd\u5b58\u81f3\u786c\u76d8\u3002 \u53c2\u6570: file_name -- \u5907\u4efd\u751f\u6210\u7684\u6587\u4ef6\u540d\uff0c\u6587\u4ef6\u540e\u7f00\u5fc5\u987b\u662f .cdb\u3002 cycle -- \u5faa\u73af\u5907\u4efd\u7684\u5468\u671f\uff0c\u5355\u4f4d \u79d2\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def save_db(self, file_name: str = 'data.cdb'): ''' \u6570\u636e\u6301\u4e45\u5316\uff0c\u5c06 CyberDB \u6570\u636e\u5e93\u4fdd\u5b58\u81f3\u786c\u76d8\u3002 \u53c2\u6570: file_name -- \u5907\u4efd\u751f\u6210\u7684\u6587\u4ef6\u540d\uff0c\u6587\u4ef6\u540e\u7f00\u5fc5\u987b\u662f .cdb\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def load_db(self, file_name: str = 'data.cdb'): ''' \u52a0\u8f7d .cdb \u683c\u5f0f\u7684\u6587\u4ef6\uff0c\u5c06\u786c\u76d8\u4e2d\u5907\u4efd\u7684 CyberDB \u6570\u636e\u5e93\u52a0\u8f7d\u56de\u5185\u5b58\u3002 \u53c2\u6570: file_name -- \u7ecf\u6570\u636e\u6301\u4e45\u5316\u751f\u6210\u7684\u6587\u4ef6\u540d\uff0c\u6587\u4ef6\u540e\u7f00\u5fc5\u987b\u662f .cdb\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' cyberdb.connect \u51fd\u6570 def cyberdb.connect(host: str = '127.0.0.1', port: int = 9980, password: str = None, encrypt: bool = False, time_out: int = None) -> Client: ''' \u5c06\u5ba2\u6237\u7aef\u8fde\u63a5\u81f3 CyberDB \u670d\u52a1\u7aef\u3002 \u53c2\u6570: host -- \u8fde\u63a5\u5730\u5740\uff0c\u5982 127.0.0.1 port -- \u8fde\u63a5\u7aef\u53e3 password -- \u8fde\u63a5\u5bc6\u7801 encrypt -- \u662f\u5426\u52a0\u5bc6\u901a\u4fe1\uff0c\u5982\u679c\u670d\u52a1\u7aef\u542f\u7528 encrypt \u4e3a True\uff0c\u6b64\u5904\u5fc5\u987b\u4e3a True\uff0c\u53cd\u4e4b\u4ea6\u7136\u3002 time_out -- \u8fde\u63a5\u6c60\u4e2d\u6bcf\u4e2a\u8fde\u63a5\u7684\u8d85\u65f6\u65f6\u95f4\uff0c\u5355\u4f4d \u79d2\u3002\u8fde\u63a5\u6c60\u7684\u8fde\u63a5\u7ecf time_out \u79d2\u65e0\u64cd\u4f5c\u5c06\u88ab\u820d\u5f03\uff0c\u4e0b\u6b21\u8fde\u63a5\u5c06\u751f\u6210\u65b0\u8fde\u63a5\u3002\u8fde\u63a5\u6c60\u5c06\u81ea\u52a8\u7ba1\u7406\u8fde\u63a5\uff0c\u5f00\u53d1\u8005\u65e0\u9700\u5173\u6ce8\u7ec6\u8282\u3002 \u6b64\u53c2\u6570\u82e5\u4e3a None\uff0c\u5219\u4e0d\u4f1a\u8d85\u65f6\uff0c\u8fde\u63a5\u6c60\u5c06\u7ef4\u6301\u8fde\u63a5\u76f4\u81f3\u5931\u6548\uff0c\u4e4b\u540e\u5c06\u91cd\u65b0\u751f\u6210\u65b0\u8fde\u63a5\u3002 \u8fd4\u56de\u7c7b\u578b: Client ''' cyberdb.Client \u7c7b class cyberdb.Client cyberdb.connect \u51fd\u6570\u8fd4\u56de\u7684 cyberdb.Client \u5bf9\u8c61\uff0c\u7528\u4e8e\u751f\u6210 Proxy \u5bf9\u8c61\u3002 def get_proxy(self) -> Proxy: ''' \u751f\u6210 Proxy \u5bf9\u8c61\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' Proxy \u7c7b cyberdb.Client.get_proxy \u65b9\u6cd5\u751f\u6210\u7684 Proxy \u5bf9\u8c61\uff0c\u53ef\u5bf9 CyberDB \u6570\u636e\u5e93\u8fdb\u884c\u64cd\u4f5c\uff0c\u5e76\u7ba1\u7406\u7531 Proxy \u751f\u6210\u7684 CyberDict\u3001CyberList \u5b50\u5bf9\u8c61\u7684 TCP \u8fde\u63a5\u3002Proxy \u5bf9\u8c61\u521d\u59cb\u5316\u540e\uff0c\u6267\u884c Proxy.connect \u65b9\u6cd5\u540e\u624d\u80fd\u4f7f\u7528\u3002Proxy \u5bf9\u8c61\u53ca\u5176\u5b50\u5bf9\u8c61\u5c06\u6267\u884c\u8fdc\u7a0b\u64cd\u4f5c\uff0c\u4f5c\u7528\u4e8e\u670d\u52a1\u7aef CyberDB \u6570\u636e\u5e93\u3002 class Proxy def connect(self): ''' \u4ece\u8fde\u63a5\u6c60\u83b7\u53d6 TCP \u8fde\u63a5\uff0c\u7ed1\u5b9a\u81f3\u8be5 Proxy \u5bf9\u8c61\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def close(self): ''' \u53d6\u6d88\u8be5 Proxy \u5bf9\u8c61\u7ed1\u5b9a\u7684 TCP \u8fde\u63a5\uff0c\u5f52\u8fd8\u81f3\u8fde\u63a5\u6c60\uff0c\u4e0b\u6b21\u64cd\u4f5c\u524d\u9700\u91cd\u65b0 \u6267\u884c Proxy.connect \u65b9\u6cd5\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def create_cyberdict(self, table_name: str, content: dict = {}): ''' \u521b\u5efa CyberDict \u8868\u3002 \u53c2\u6570: table_name -- \u8868\u540d\u3002 content -- \u8868\u5185\u5bb9\uff0c\u9700\u8981\u662f\u5b57\u5178\u7c7b\u578b\uff0c\u9ed8\u8ba4\u4e3a\u7a7a\u5b57\u5178\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def create_cyberlist(self, table_name: str, content: list = []): ''' \u521b\u5efa CyberList \u8868\u3002 \u53c2\u6570: table_name -- \u8868\u540d\u3002 content -- \u8868\u5185\u5bb9\uff0c\u9700\u8981\u662f\u5217\u8868\u7c7b\u578b\uff0c\u9ed8\u8ba4\u4e3a\u7a7a\u5217\u8868\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def get_cyberdict(self, table_name: str) -> CyberDict: ''' \u83b7\u53d6 CyberDict \u8868\u3002 \u53c2\u6570: table_name -- \u8868\u540d\u3002 \u8fd4\u56de\u7c7b\u578b: CyberDict\uff0c\u8be5\u5bf9\u8c61\u662f Proxy \u751f\u6210\u7684\u5b50\u5bf9\u8c61\uff0c\u7531 Proxy \u63a7\u5236 TCP \u8fde\u63a5\u3002 ''' def get_cyberlist(self, table_name: str) -> CyberList: ''' \u83b7\u53d6 CyberList \u8868\u3002 \u53c2\u6570: table_name -- \u8868\u540d\u3002 \u8fd4\u56de\u7c7b\u578b: CyberList\uff0c\u8be5\u5bf9\u8c61\u662f Proxy \u751f\u6210\u7684\u5b50\u5bf9\u8c61\uff0c\u7531 Proxy \u63a7\u5236 TCP \u8fde\u63a5\u3002 ''' def print_tables(self): ''' \u6253\u5370 CyberDB \u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u8868\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def delete_table(self, table_name: str): ''' \u5220\u9664 CyberDB \u6570\u636e\u5e93\u4e2d\u7684 table_name \u8868\u3002 \u53c2\u6570: table_name -- \u5220\u9664\u7684\u8868\u540d\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' cyberdb.CyberDict \u7c7b class cyberdb.CyberDict \u7531 Proxy \u5bf9\u8c61\u751f\u6210\u7684\u5b50\u5bf9\u8c61\uff0c\u7528\u4e8e\u6267\u884c Dictionaries \u64cd\u4f5c\u3002\u8be5\u5bf9\u8c61\u5c06\u6267\u884c\u8fdc\u7a0b\u64cd\u4f5c\uff0c\u4f5c\u7528\u4e8e\u670d\u52a1\u7aef CyberDB \u6570\u636e\u5e93\u3002\u548c Proxy \u5bf9\u8c61\u5171\u7528\u540c\u4e00\u4e2a TCP \u8fde\u63a5\u3002\u5c06\u8ddf\u968f Proxy \u7684\u8fde\u63a5\u800c\u8fde\u63a5\uff0cProxy \u91ca\u653e\u8fde\u63a5\u540e\uff0c\u8be5\u5bf9\u8c61\u4e5f\u4f1a\u5931\u53bb\u8fde\u63a5\u3002CyberDict \u53ef\u4ee5\u6267\u884c Dictionaries \u7684 get\u3001setdefault\u3001update\u3001keys\u3001values\u3001items\u3001pop\u3001popitem\u3001clear \u65b9\u6cd5\u4ee5\u53ca\u5e38\u7528\u9b54\u672f\u65b9\u6cd5\uff0c\u6b64\u90e8\u5206\u8bf7\u53c2\u8003 Python \u5b57\u5178\u5b98\u65b9\u6587\u6863 \u3002 \u4f7f\u7528 for \u5faa\u73af\u8fed\u4ee3 CyberDict\uff0c\u5ba2\u6237\u7aef\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a o(n), n \u4e3a CyberDict.keys() \u7684\u957f\u5ea6\u3002 def todict(self) -> Dict: ''' \u5c06 CyberDict \u8f6c\u4e3a Dictionaries\u3002 \u8fd4\u56de\u7c7b\u578b: Dict ''' cyberdb.CyberList \u7c7b class cyberdb.CyberList \u7531 Proxy \u5bf9\u8c61\u751f\u6210\u7684\u5b50\u5bf9\u8c61\uff0c\u7528\u4e8e\u6267\u884c Lists \u64cd\u4f5c\u3002\u8be5\u5bf9\u8c61\u5c06\u6267\u884c\u8fdc\u7a0b\u64cd\u4f5c\uff0c\u4f5c\u7528\u4e8e\u670d\u52a1\u7aef CyberDB \u6570\u636e\u5e93\u3002\u548c Proxy \u5bf9\u8c61\u5171\u7528\u540c\u4e00\u4e2a TCP \u8fde\u63a5\u3002\u5c06\u8ddf\u968f Proxy \u7684\u8fde\u63a5\u800c\u8fde\u63a5\uff0cProxy \u91ca\u653e\u8fde\u63a5\u540e\uff0c\u8be5\u5bf9\u8c61\u4e5f\u4f1a\u5931\u53bb\u8fde\u63a5\u3002CyberList \u53ef\u4ee5\u6267\u884c Lists \u7684 append\u3001extend\u3001insert\u3001pop\u3001remove\u3001count\u3001index\u3001reverse\u3001sort\u3001clear \u65b9\u6cd5\u4ee5\u53ca\u5e38\u7528\u9b54\u672f\u65b9\u6cd5\uff0c\u6b64\u90e8\u5206\u8bf7\u53c2\u8003 Python \u5217\u8868\u5b98\u65b9\u6587\u6863 \u3002 \u4f7f\u7528 for \u5faa\u73af\u8fed\u4ee3 CyberList\uff0c\u6bcf\u6b21\u8fed\u4ee3\u5c06\u4ece\u670d\u52a1\u7aef\u83b7\u53d6\u5185\u5bb9\uff0c\u5ba2\u6237\u7aef\u7684\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a o(1)\u3002 def tolist(self) -> List: ''' \u5c06 CyberList \u8f6c\u4e3a Lists\u3002 \u8fd4\u56de\u7c7b\u578b: List '''","title":"API"},{"location":"API/#api","text":"\u8fd9\u90e8\u5206\u6587\u6863\u6db5\u76d6\u4e86 CyberDB \u7684\u6240\u6709\u63a5\u53e3\u3002\u5bf9\u4e8e CyberDB \u4f9d\u8d56\u4e8e\u5916\u90e8\u5e93\u7684\u90e8\u5206\uff0c\u6211\u4eec\u5728\u6b64\u5904\u8bb0\u5f55\u6700\u91cd\u8981\u7684\u90e8\u5206\u5e76\u63d0\u4f9b\u6307\u5411\u89c4\u8303\u6587\u6863\u7684\u94fe\u63a5\u3002","title":"API"},{"location":"API/#cyberdbserver","text":"class cyberdb.Server \u8be5\u7c7b\u7528\u4e8e\u521b\u5efa CyberDB \u670d\u52a1\u7aef\u5bf9\u8c61\u3002 def start(self, host: str = '127.0.0.1', port: int = 9980, password: str = None, max_con: int = 500, timeout: int = 0, print_log: bool = False, encrypt: bool = False): ''' \u540e\u53f0\u542f\u52a8 CyberDB \u670d\u52a1\u5668\uff0c\u8be5\u64cd\u4f5c\u4e0d\u4f1a\u963b\u585e\u524d\u53f0\u4efb\u52a1\u3002 \u53c2\u6570: host -- TCP \u76d1\u542c\u4e3b\u673a\u5730\u5740\uff0c\u5982 127.0.0.1\u3002 port -- TCP \u76d1\u542c\u7aef\u53e3\u3002 password -- TCP \u901a\u4fe1\u5bc6\u7801\uff0c\u5efa\u8bae\u91c7\u7528 \u82f1\u6587\u5b57\u6bcd\u548c\u6570\u5b57\u7684\u7ec4\u5408\u65b9\u5f0f\uff0c \u6700\u957f\u4e0d\u8d85\u8fc7 32 \u4e2a\u5b57\u7b26\u3002 max_con -- \u6700\u5927\u5e76\u53d1\u6570\u3002 timeout -- \u5355\u4e2a\u8fde\u63a5\u7684\u8d85\u65f6\u65f6\u95f4\uff0c\u5355\u4f4d \u79d2\u3002 print_log -- \u662f\u5426\u6253\u5370\u901a\u4fe1\u65e5\u5fd7\uff0cFasle \u4e3a\u4e0d\u6253\u5370\u3002 encrypt -- \u662f\u5426\u52a0\u5bc6\u901a\u4fe1\u5185\u5bb9\uff0cFasle \u4e3a\u4e0d\u52a0\u5bc6\u3002\u6b64\u52a0\u5bc6\u7b97\u6cd5\u4e3a AES-256\uff0c\u5bc6\u94a5\u4e3a password\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def run(self, host: str = '127.0.0.1', port: int = 9980, password: str = None, max_con: int = 500, timeout: int = 0, print_log: bool = False, encrypt: bool = False): ''' \u524d\u53f0\u8fd0\u884c CyberDB \u670d\u52a1\u5668\uff0c\u8be5\u64cd\u4f5c\u4f1a\u963b\u585e\u524d\u53f0\u4efb\u52a1\u3002 \u53c2\u6570\u548c start \u65b9\u6cd5\u76f8\u540c\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def set_ip_whitelist(self, ips: list): ''' \u8bbe\u7f6e ip \u767d\u540d\u5355\uff0cCyberDB \u52a0\u5bc6\u901a\u4fe1\u65f6\u4ec5\u5141\u8bb8\u767d\u540d\u5355\u7684 ip \u8fde\u63a5\uff0c \u8be5\u65b9\u6cd5\u4ec5\u5728 cyberdb.Server.start(encrypt=True) \u6216 cyberdb.Server.run(encrypt=True) \u542f\u7528\u65f6\u6709\u6548\u3002 \u53c2\u6570: ips -- \u7c7b\u578b\u4e3a\u5217\u8868\uff0c\u683c\u5f0f\u5982 ['192.168.1.1', '118.123.89.137'] \u8fd4\u56de\u7c7b\u578b: None ''' def set_backup(self, file_name: str = 'data.cdb', cycle: int = 900): ''' \u8bbe\u7f6e\u5b9a\u65f6\u5907\u4efd\uff0c\u8be5\u64cd\u4f5c\u8bbe\u7f6e\u540e\uff0c\u5c06\u5728\u6307\u5b9a\u5468\u671f\u8fdb\u884c\u6570\u636e\u6301\u4e45\u5316\u5907\u4efd\uff0c\u5c06 CyberDB \u6570\u636e\u5e93\u4fdd\u5b58\u81f3\u786c\u76d8\u3002 \u53c2\u6570: file_name -- \u5907\u4efd\u751f\u6210\u7684\u6587\u4ef6\u540d\uff0c\u6587\u4ef6\u540e\u7f00\u5fc5\u987b\u662f .cdb\u3002 cycle -- \u5faa\u73af\u5907\u4efd\u7684\u5468\u671f\uff0c\u5355\u4f4d \u79d2\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def save_db(self, file_name: str = 'data.cdb'): ''' \u6570\u636e\u6301\u4e45\u5316\uff0c\u5c06 CyberDB \u6570\u636e\u5e93\u4fdd\u5b58\u81f3\u786c\u76d8\u3002 \u53c2\u6570: file_name -- \u5907\u4efd\u751f\u6210\u7684\u6587\u4ef6\u540d\uff0c\u6587\u4ef6\u540e\u7f00\u5fc5\u987b\u662f .cdb\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def load_db(self, file_name: str = 'data.cdb'): ''' \u52a0\u8f7d .cdb \u683c\u5f0f\u7684\u6587\u4ef6\uff0c\u5c06\u786c\u76d8\u4e2d\u5907\u4efd\u7684 CyberDB \u6570\u636e\u5e93\u52a0\u8f7d\u56de\u5185\u5b58\u3002 \u53c2\u6570: file_name -- \u7ecf\u6570\u636e\u6301\u4e45\u5316\u751f\u6210\u7684\u6587\u4ef6\u540d\uff0c\u6587\u4ef6\u540e\u7f00\u5fc5\u987b\u662f .cdb\u3002 \u8fd4\u56de\u7c7b\u578b: None '''","title":"cyberdb.Server \u7c7b"},{"location":"API/#cyberdbconnect","text":"def cyberdb.connect(host: str = '127.0.0.1', port: int = 9980, password: str = None, encrypt: bool = False, time_out: int = None) -> Client: ''' \u5c06\u5ba2\u6237\u7aef\u8fde\u63a5\u81f3 CyberDB \u670d\u52a1\u7aef\u3002 \u53c2\u6570: host -- \u8fde\u63a5\u5730\u5740\uff0c\u5982 127.0.0.1 port -- \u8fde\u63a5\u7aef\u53e3 password -- \u8fde\u63a5\u5bc6\u7801 encrypt -- \u662f\u5426\u52a0\u5bc6\u901a\u4fe1\uff0c\u5982\u679c\u670d\u52a1\u7aef\u542f\u7528 encrypt \u4e3a True\uff0c\u6b64\u5904\u5fc5\u987b\u4e3a True\uff0c\u53cd\u4e4b\u4ea6\u7136\u3002 time_out -- \u8fde\u63a5\u6c60\u4e2d\u6bcf\u4e2a\u8fde\u63a5\u7684\u8d85\u65f6\u65f6\u95f4\uff0c\u5355\u4f4d \u79d2\u3002\u8fde\u63a5\u6c60\u7684\u8fde\u63a5\u7ecf time_out \u79d2\u65e0\u64cd\u4f5c\u5c06\u88ab\u820d\u5f03\uff0c\u4e0b\u6b21\u8fde\u63a5\u5c06\u751f\u6210\u65b0\u8fde\u63a5\u3002\u8fde\u63a5\u6c60\u5c06\u81ea\u52a8\u7ba1\u7406\u8fde\u63a5\uff0c\u5f00\u53d1\u8005\u65e0\u9700\u5173\u6ce8\u7ec6\u8282\u3002 \u6b64\u53c2\u6570\u82e5\u4e3a None\uff0c\u5219\u4e0d\u4f1a\u8d85\u65f6\uff0c\u8fde\u63a5\u6c60\u5c06\u7ef4\u6301\u8fde\u63a5\u76f4\u81f3\u5931\u6548\uff0c\u4e4b\u540e\u5c06\u91cd\u65b0\u751f\u6210\u65b0\u8fde\u63a5\u3002 \u8fd4\u56de\u7c7b\u578b: Client '''","title":"cyberdb.connect \u51fd\u6570"},{"location":"API/#cyberdbclient","text":"class cyberdb.Client cyberdb.connect \u51fd\u6570\u8fd4\u56de\u7684 cyberdb.Client \u5bf9\u8c61\uff0c\u7528\u4e8e\u751f\u6210 Proxy \u5bf9\u8c61\u3002 def get_proxy(self) -> Proxy: ''' \u751f\u6210 Proxy \u5bf9\u8c61\u3002 \u8fd4\u56de\u7c7b\u578b: None '''","title":"cyberdb.Client \u7c7b"},{"location":"API/#proxy","text":"cyberdb.Client.get_proxy \u65b9\u6cd5\u751f\u6210\u7684 Proxy \u5bf9\u8c61\uff0c\u53ef\u5bf9 CyberDB \u6570\u636e\u5e93\u8fdb\u884c\u64cd\u4f5c\uff0c\u5e76\u7ba1\u7406\u7531 Proxy \u751f\u6210\u7684 CyberDict\u3001CyberList \u5b50\u5bf9\u8c61\u7684 TCP \u8fde\u63a5\u3002Proxy \u5bf9\u8c61\u521d\u59cb\u5316\u540e\uff0c\u6267\u884c Proxy.connect \u65b9\u6cd5\u540e\u624d\u80fd\u4f7f\u7528\u3002Proxy \u5bf9\u8c61\u53ca\u5176\u5b50\u5bf9\u8c61\u5c06\u6267\u884c\u8fdc\u7a0b\u64cd\u4f5c\uff0c\u4f5c\u7528\u4e8e\u670d\u52a1\u7aef CyberDB \u6570\u636e\u5e93\u3002 class Proxy def connect(self): ''' \u4ece\u8fde\u63a5\u6c60\u83b7\u53d6 TCP \u8fde\u63a5\uff0c\u7ed1\u5b9a\u81f3\u8be5 Proxy \u5bf9\u8c61\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def close(self): ''' \u53d6\u6d88\u8be5 Proxy \u5bf9\u8c61\u7ed1\u5b9a\u7684 TCP \u8fde\u63a5\uff0c\u5f52\u8fd8\u81f3\u8fde\u63a5\u6c60\uff0c\u4e0b\u6b21\u64cd\u4f5c\u524d\u9700\u91cd\u65b0 \u6267\u884c Proxy.connect \u65b9\u6cd5\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def create_cyberdict(self, table_name: str, content: dict = {}): ''' \u521b\u5efa CyberDict \u8868\u3002 \u53c2\u6570: table_name -- \u8868\u540d\u3002 content -- \u8868\u5185\u5bb9\uff0c\u9700\u8981\u662f\u5b57\u5178\u7c7b\u578b\uff0c\u9ed8\u8ba4\u4e3a\u7a7a\u5b57\u5178\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def create_cyberlist(self, table_name: str, content: list = []): ''' \u521b\u5efa CyberList \u8868\u3002 \u53c2\u6570: table_name -- \u8868\u540d\u3002 content -- \u8868\u5185\u5bb9\uff0c\u9700\u8981\u662f\u5217\u8868\u7c7b\u578b\uff0c\u9ed8\u8ba4\u4e3a\u7a7a\u5217\u8868\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def get_cyberdict(self, table_name: str) -> CyberDict: ''' \u83b7\u53d6 CyberDict \u8868\u3002 \u53c2\u6570: table_name -- \u8868\u540d\u3002 \u8fd4\u56de\u7c7b\u578b: CyberDict\uff0c\u8be5\u5bf9\u8c61\u662f Proxy \u751f\u6210\u7684\u5b50\u5bf9\u8c61\uff0c\u7531 Proxy \u63a7\u5236 TCP \u8fde\u63a5\u3002 ''' def get_cyberlist(self, table_name: str) -> CyberList: ''' \u83b7\u53d6 CyberList \u8868\u3002 \u53c2\u6570: table_name -- \u8868\u540d\u3002 \u8fd4\u56de\u7c7b\u578b: CyberList\uff0c\u8be5\u5bf9\u8c61\u662f Proxy \u751f\u6210\u7684\u5b50\u5bf9\u8c61\uff0c\u7531 Proxy \u63a7\u5236 TCP \u8fde\u63a5\u3002 ''' def print_tables(self): ''' \u6253\u5370 CyberDB \u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u8868\u3002 \u8fd4\u56de\u7c7b\u578b: None ''' def delete_table(self, table_name: str): ''' \u5220\u9664 CyberDB \u6570\u636e\u5e93\u4e2d\u7684 table_name \u8868\u3002 \u53c2\u6570: table_name -- \u5220\u9664\u7684\u8868\u540d\u3002 \u8fd4\u56de\u7c7b\u578b: None '''","title":"Proxy \u7c7b"},{"location":"API/#cyberdbcyberdict","text":"class cyberdb.CyberDict \u7531 Proxy \u5bf9\u8c61\u751f\u6210\u7684\u5b50\u5bf9\u8c61\uff0c\u7528\u4e8e\u6267\u884c Dictionaries \u64cd\u4f5c\u3002\u8be5\u5bf9\u8c61\u5c06\u6267\u884c\u8fdc\u7a0b\u64cd\u4f5c\uff0c\u4f5c\u7528\u4e8e\u670d\u52a1\u7aef CyberDB \u6570\u636e\u5e93\u3002\u548c Proxy \u5bf9\u8c61\u5171\u7528\u540c\u4e00\u4e2a TCP \u8fde\u63a5\u3002\u5c06\u8ddf\u968f Proxy \u7684\u8fde\u63a5\u800c\u8fde\u63a5\uff0cProxy \u91ca\u653e\u8fde\u63a5\u540e\uff0c\u8be5\u5bf9\u8c61\u4e5f\u4f1a\u5931\u53bb\u8fde\u63a5\u3002CyberDict \u53ef\u4ee5\u6267\u884c Dictionaries \u7684 get\u3001setdefault\u3001update\u3001keys\u3001values\u3001items\u3001pop\u3001popitem\u3001clear \u65b9\u6cd5\u4ee5\u53ca\u5e38\u7528\u9b54\u672f\u65b9\u6cd5\uff0c\u6b64\u90e8\u5206\u8bf7\u53c2\u8003 Python \u5b57\u5178\u5b98\u65b9\u6587\u6863 \u3002 \u4f7f\u7528 for \u5faa\u73af\u8fed\u4ee3 CyberDict\uff0c\u5ba2\u6237\u7aef\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a o(n), n \u4e3a CyberDict.keys() \u7684\u957f\u5ea6\u3002 def todict(self) -> Dict: ''' \u5c06 CyberDict \u8f6c\u4e3a Dictionaries\u3002 \u8fd4\u56de\u7c7b\u578b: Dict '''","title":"cyberdb.CyberDict \u7c7b"},{"location":"API/#cyberdbcyberlist","text":"class cyberdb.CyberList \u7531 Proxy \u5bf9\u8c61\u751f\u6210\u7684\u5b50\u5bf9\u8c61\uff0c\u7528\u4e8e\u6267\u884c Lists \u64cd\u4f5c\u3002\u8be5\u5bf9\u8c61\u5c06\u6267\u884c\u8fdc\u7a0b\u64cd\u4f5c\uff0c\u4f5c\u7528\u4e8e\u670d\u52a1\u7aef CyberDB \u6570\u636e\u5e93\u3002\u548c Proxy \u5bf9\u8c61\u5171\u7528\u540c\u4e00\u4e2a TCP \u8fde\u63a5\u3002\u5c06\u8ddf\u968f Proxy \u7684\u8fde\u63a5\u800c\u8fde\u63a5\uff0cProxy \u91ca\u653e\u8fde\u63a5\u540e\uff0c\u8be5\u5bf9\u8c61\u4e5f\u4f1a\u5931\u53bb\u8fde\u63a5\u3002CyberList \u53ef\u4ee5\u6267\u884c Lists \u7684 append\u3001extend\u3001insert\u3001pop\u3001remove\u3001count\u3001index\u3001reverse\u3001sort\u3001clear \u65b9\u6cd5\u4ee5\u53ca\u5e38\u7528\u9b54\u672f\u65b9\u6cd5\uff0c\u6b64\u90e8\u5206\u8bf7\u53c2\u8003 Python \u5217\u8868\u5b98\u65b9\u6587\u6863 \u3002 \u4f7f\u7528 for \u5faa\u73af\u8fed\u4ee3 CyberList\uff0c\u6bcf\u6b21\u8fed\u4ee3\u5c06\u4ece\u670d\u52a1\u7aef\u83b7\u53d6\u5185\u5bb9\uff0c\u5ba2\u6237\u7aef\u7684\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a o(1)\u3002 def tolist(self) -> List: ''' \u5c06 CyberList \u8f6c\u4e3a Lists\u3002 \u8fd4\u56de\u7c7b\u578b: List '''","title":"cyberdb.CyberList \u7c7b"}]}
\ No newline at end of file
diff --git a/documentation_chn/site/sitemap.xml.gz b/documentation_chn/site/sitemap.xml.gz
index 679b7ed95747d0538cc8a880813977d7d6982e39..3f20220f618f16d87f266791f43f84b283630dfc 100644
GIT binary patch
delta 14
Vcmcc0c$JY&zMF$%Lh3}e^8g~v1jqmY

delta 14
Vcmcc0c$JY&zMF%?On)NVc>o|Y1ULWy