Skip to content

Commit a5e93b9

Browse files
Merge pull request #32 from epsilla-cloud/add-sharding-config
Support sharding and replica configs
2 parents 7787827 + 4c45bfd commit a5e93b9

3 files changed

Lines changed: 26 additions & 5 deletions

File tree

examples/hello_epsilla_enterprise.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@
1515

1616
db_name = "helloepsilla"
1717
db_id = "helloepsilla-1234567890"
18-
table_name = "HelloEpsilla"
19-
2018

2119
# Create a new db
22-
status_code, response = client.create_db(db_name, db_id)
20+
status_code, response = client.create_db(
21+
db_name,
22+
db_id,
23+
min_replicas = 2,
24+
max_replicas = 2,
25+
sharding_init_number = 3,
26+
sharding_capacity = 1000000,
27+
)
2328
print(status_code, response)
2429

2530
# Get info of db

pyepsilla/enterprise/client.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,25 @@ def create_db(
7777
db_name: str = Field(pattern=r"^[a-zA-Z-0-9]{4,32}$", strict=True),
7878
db_id: Optional[str] = None,
7979
project_id: Optional[str] = "default",
80+
min_replicas: Optional[int] = 0,
81+
max_replicas: Optional[int] = 1,
82+
sharding_init_number: Optional[int] = 1,
83+
sharding_increase_step: Optional[int] = 2,
84+
sharding_capacity: Optional[int] = 150000,
85+
sharding_increase_threshold: Optional[float] = 0.9,
8086
):
8187
req_url = "{}/vectordb/create".format(self._baseurl)
82-
req_data = {"db_name": db_name, "db_uuid": db_id, "project_id": project_id}
88+
req_data = {
89+
"db_name": db_name,
90+
"db_uuid": db_id,
91+
"project_id": project_id,
92+
"min_replicas": min_replicas,
93+
"max_replicas": max_replicas,
94+
"sharding_init_number": sharding_init_number,
95+
"sharding_increase_step": sharding_increase_step,
96+
"sharding_capacity": sharding_capacity,
97+
"sharding_increase_threshold": sharding_increase_threshold,
98+
}
8399
resp = requests.post(
84100
url=req_url,
85101
data=json.dumps(req_data),

pyepsilla/vectordb/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.1.23"
1+
__version__ = "0.1.24"

0 commit comments

Comments
 (0)