Skip to content

Commit 3ca8c8d

Browse files
committed
update pip
1 parent 269fb2e commit 3ca8c8d

File tree

14 files changed

+32
-29
lines changed

14 files changed

+32
-29
lines changed

.gitignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.idea/
2-
example/data/
2+
FlyDB/example/data/
33
.git/
4-
FlyDB_SDK_Python.egg-info/
5-
dist/
4+
FlyDB.egg-info/
5+
dist/
6+
build/
7+
*__pycache__/

FlyDB/__init__.py

Whitespace-only changes.

FlyDB/client_grpc/__init__.py

Whitespace-only changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""Client and server classes corresponding to protobuf-defined services."""
33
import grpc
44

5-
import database.client_grpc.db_pb2 as lib_dot_proto_dot_gstring_dot_db__pb2
5+
import FlyDB.client_grpc.db_pb2 as lib_dot_proto_dot_gstring_dot_db__pb2
66

77
class GStringServiceStub(object):
88
"""Missing associated documentation comment in .proto file."""

database/db.py renamed to FlyDB/db.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from typing import Union
22
import grpc
3-
from database.client_grpc import db_pb2_grpc, db_pb2
3+
from FlyDB.client_grpc import db_pb2_grpc
4+
from FlyDB.client_grpc import db_pb2
45

56

67
class FlyDB:
@@ -34,7 +35,7 @@ def connect_option(self, dir_path: str, data_file_size: int, sync_write: bool):
3435
Connects to the gRPC server with provided options.
3536
3637
Parameters:
37-
dir_path (str): The directory path for the database.
38+
dir_path (str): The directory path for the FlyDB2.
3839
data_file_size (int): The size of data files.
3940
sync_write (bool): Indicates whether to use synchronous writes.
4041
@@ -59,7 +60,7 @@ def connect_option(self, dir_path: str, data_file_size: int, sync_write: bool):
5960

6061
def set(self, key: str, value: Union[str, int, float, bool, bytes], expire: int):
6162
"""
62-
Sets the key-value pair in the database.
63+
Sets the key-value pair in the FlyDB2.
6364
6465
Parameters:
6566
key (str): The key to be set.
@@ -95,7 +96,7 @@ def set(self, key: str, value: Union[str, int, float, bool, bytes], expire: int)
9596

9697
def get(self, key):
9798
"""
98-
Retrieves the value associated with the given key from the database.
99+
Retrieves the value associated with the given key from the FlyDB2.
99100
100101
Parameters:
101102
key (str): The key for which the value needs to be retrieved.
@@ -104,8 +105,8 @@ def get(self, key):
104105
Union[str, int, float, bool, bytes]: The value associated with the given key.
105106
106107
Raises:
107-
KeyError: If the key is not found in the database.
108-
TimeoutError: If the key has expired in the database.
108+
KeyError: If the key is not found in the FlyDB2.
109+
TimeoutError: If the key has expired in the FlyDB2.
109110
"""
110111
request = db_pb2.GetRequest()
111112
request.key = key
@@ -126,15 +127,15 @@ def get(self, key):
126127
raise ValueError("Unsupported value type")
127128
except grpc._channel._InactiveRpcError as e:
128129
if "KeyNotFoundError" in str(e):
129-
raise KeyError("key is not found in the database")
130+
raise KeyError("key is not found in the FlyDB2")
130131
elif "Wrong value" in str(e):
131132
raise TimeoutError("key expired")
132133
else:
133134
raise
134135

135136
def delete(self, key):
136137
"""
137-
Deletes the key-value pair from the database.
138+
Deletes the key-value pair from the FlyDB2.
138139
139140
Parameters:
140141
key (str): The key to be deleted.
@@ -143,7 +144,7 @@ def delete(self, key):
143144
None
144145
145146
Raises:
146-
KeyError: If the key is not found in the database.
147+
KeyError: If the key is not found in the FlyDB2.
147148
"""
148149
request = db_pb2.DelRequest()
149150
request.key = key
@@ -153,7 +154,7 @@ def delete(self, key):
153154
print("Delete data success!")
154155
except grpc._channel._InactiveRpcError as e:
155156
if "KeyNotFoundError" in str(e):
156-
raise KeyError("key is not found in the database")
157+
raise KeyError("key is not found in the FlyDB2")
157158
else:
158159
raise
159160

FlyDB/example/__init__.py

Whitespace-only changes.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from pathlib import Path
2-
from database import db
2+
from FlyDB import db
33

4-
# Create a database client
4+
# Create a FlyDB2 client
55
db_client = db.FlyDB()
66

7-
# Connect to the database
7+
# Connect to the FlyDB2
88
path = Path.cwd().joinpath("data")
99
db_client.connect_option(str(path), 256*1024*1024, True)
1010

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ Here's a simple example showing how to use FlyDB-SDK-Python to connect to the Fl
2727

2828
```python
2929
from pathlib import Path
30-
from database import db
30+
from FlyDB2 import db
3131

32-
# Create a database client
32+
# Create a FlyDB2 client
3333
db_client = db.FlyDB()
3434

35-
# Connect to the database
35+
# Connect to the FlyDB2
3636
path = Path.cwd().joinpath("data")
37-
db_client.connect_option(str(path), 256*1024*1024, True)
37+
db_client.connect_option(str(path), 256 * 1024 * 1024, True)
3838

3939
# Set a key-value pair
4040
db_client.set("key", "value", 0)

README_CN.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ FlyDB是一个高性能、轻量级的键值数据库,通过这个SDK,您可
1616
安装FlyDB-SDK-Python可以通过pip进行,运行以下命令:
1717

1818
```bash
19-
pip install FlyDB-SDK-Python
19+
pip install FlyDB2-SDK-Python
2020
```
2121

2222
## 快速上手
@@ -25,14 +25,14 @@ pip install FlyDB-SDK-Python
2525

2626
```python
2727
from pathlib import Path
28-
from database import db
28+
from FlyDB import db
2929

30-
# Create a database client
30+
# Create a FlyDB2 client
3131
db_client = db.FlyDB()
3232

33-
# Connect to the database
33+
# Connect to the FlyDB2
3434
path = Path.cwd().joinpath("data")
35-
db_client.connect_option(str(path), 256*1024*1024, True)
35+
db_client.connect_option(str(path), 256 * 1024 * 1024, True)
3636

3737
# Set a key-value pair
3838
db_client.set("key", "value", 0)

0 commit comments

Comments
 (0)