Skip to content

Commit 1aea2b9

Browse files
authored
update xet api paths (#1741)
updates API paths to use plural nouns as consistent with specification draft and latest deployed CAS server.
1 parent 411e5ce commit 1aea2b9

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

packages/hub/scripts/bench.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ function createMockFetch(args: { write: boolean }): {
157157
const url = typeof input === "string" ? input : input.toString();
158158

159159
// Mock successful responses for xorb and shard uploads
160-
if (url.includes("/xorb/")) {
160+
if (url.includes("/xorbs/")) {
161161
xorbCount++;
162162
const bodySize = getBodySize(init?.body);
163163
xorbBytes += parseInt(bodySize);
@@ -174,7 +174,7 @@ function createMockFetch(args: { write: boolean }): {
174174
});
175175
}
176176

177-
if (url.endsWith("/shard")) {
177+
if (url.endsWith("/shards")) {
178178
shardCount++;
179179
const bodySize = getBodySize(init?.body);
180180
shardBytes += parseInt(bodySize);

packages/hub/src/utils/XetBlob.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ export class XetBlob extends Blob {
159159
const connParams = await getAccessToken(this.accessToken, this.fetch, this.refreshUrl);
160160

161161
// debug(
162-
// `curl '${connParams.casUrl}/v1/reconstruction/${this.hash}' -H 'Authorization: Bearer ${connParams.accessToken}'`
162+
// `curl '${connParams.casUrl}/v1/reconstructions/${this.hash}' -H 'Authorization: Bearer ${connParams.accessToken}'`
163163
// );
164164

165-
const resp = await this.fetch(this.reconstructionUrl ?? `${connParams.casUrl}/v1/reconstruction/${this.hash}`, {
165+
const resp = await this.fetch(this.reconstructionUrl ?? `${connParams.casUrl}/v1/reconstructions/${this.hash}`, {
166166
headers: {
167167
Authorization: `Bearer ${connParams.accessToken}`,
168168
Range: `bytes=${this.start}-${this.end - 1}`,

packages/hub/src/utils/createXorbs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export async function* createXorbs(
202202
const token = await xetWriteToken(params);
203203
bytesSinceRemoteDedup = 0;
204204

205-
const shardResp = await (params.fetch ?? fetch)(token.casUrl + "/v1/chunk/default/" + chunk.hash, {
205+
const shardResp = await (params.fetch ?? fetch)(token.casUrl + "/v1/chunks/default/" + chunk.hash, {
206206
headers: {
207207
Authorization: `Bearer ${token.accessToken}`,
208208
},
@@ -683,7 +683,7 @@ async function loadDedupInfoToCache(
683683
const token = await xetWriteToken(params);
684684
bytesSinceRemoteDedup = 0;
685685

686-
const shardResp = await (params.fetch ?? fetch)(token.casUrl + "/v1/chunk/default/" + chunk.hash, {
686+
const shardResp = await (params.fetch ?? fetch)(token.casUrl + "/v1/chunks/default/" + chunk.hash, {
687687
headers: {
688688
Authorization: `Bearer ${token.accessToken}`,
689689
},

packages/hub/src/utils/uploadShards.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ async function uploadXorb(
359359
) {
360360
const token = await xetWriteToken(params);
361361

362-
const resp = await (params.fetch ?? fetch)(`${token.casUrl}/v1/xorb/default/${xorb.hash}`, {
362+
const resp = await (params.fetch ?? fetch)(`${token.casUrl}/v1/xorbs/default/${xorb.hash}`, {
363363
method: "POST",
364364
body: xorb.xorb,
365365
headers: {
@@ -388,7 +388,7 @@ async function uploadXorb(
388388
async function uploadShard(shard: Uint8Array, params: UploadShardsParams) {
389389
const token = await xetWriteToken(params);
390390

391-
const resp = await (params.fetch ?? fetch)(`${token.casUrl}/v1/shard`, {
391+
const resp = await (params.fetch ?? fetch)(`${token.casUrl}/v1/shards`, {
392392
method: "POST",
393393
body: shard,
394394
headers: {

0 commit comments

Comments
 (0)