Skip to content

Commit

Permalink
feat: remove store protocol
Browse files Browse the repository at this point in the history
The store protocol in not compatible with decentralized storage as there are no "bucket events" on remote storage nodes.
  • Loading branch information
alanshaw committed Nov 5, 2024
1 parent c810735 commit d59ec88
Show file tree
Hide file tree
Showing 33 changed files with 34 additions and 3,012 deletions.
5 changes: 0 additions & 5 deletions packages/upload-api/src/admin.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import * as Types from './types.js'
import * as StoreInspect from './admin/store/inspect.js'
import * as UploadInspect from './admin/upload/inspect.js'

/**
* @param {Types.AdminServiceContext} context
*/
export const createService = (context) => ({
store: {
inspect: StoreInspect.provide(context),
},

upload: {
inspect: UploadInspect.provide(context),
},
Expand Down
43 changes: 0 additions & 43 deletions packages/upload-api/src/admin/store/inspect.js

This file was deleted.

18 changes: 6 additions & 12 deletions packages/upload-api/src/blob/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { ed25519 } from '@ucanto/principal'
import * as Blob from '@storacha/capabilities/blob'
import * as SpaceBlob from '@storacha/capabilities/space/blob'
import * as HTTP from '@storacha/capabilities/http'
import * as Digest from 'multiformats/hashes/digest'
import * as API from '../types.js'
import { allocate as spaceAllocate } from '../space-allocate.js'
import { createConcludeInvocation } from '../ucan/conclude.js'
import { AwaitError } from './lib.js'
import * as Digest from 'multiformats/hashes/digest'
import { AgentMessage } from '../lib.js'

/**
Expand Down Expand Up @@ -101,21 +102,14 @@ async function allocate({ context, blob, space, cause }) {
// First we check if space has storage provider associated. If it does not
// we return `InsufficientStorage` error as storage capacity is considered
// to be 0.
const provisioned = await context.provisionsStorage.hasStorageProvider(space)
const provisioned = await spaceAllocate(
{ capability: { with: space } },
context
)
if (provisioned.error) {
return provisioned
}

if (!provisioned.ok) {
return {
/** @type {API.AllocationError} */
error: {
name: 'InsufficientStorage',
message: `${space} has no storage provider`,
},
}
}

// 1. Create blob/allocate invocation and task
const { router } = context
const digest = Digest.decode(blob.digest)
Expand Down
2 changes: 0 additions & 2 deletions packages/upload-api/src/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import * as Types from './types.js'
import * as Legacy from '@ucanto/transport/legacy'
import * as CAR from '@ucanto/transport/car'
import { create as createRevocationChecker } from './utils/revocation.js'
import { createService as createStoreService } from './store.js'
import { createService as createUploadService } from './upload.js'
import { createService as createConsoleService } from './console.js'
import { createService as createAccessService } from './access.js'
Expand Down Expand Up @@ -181,7 +180,6 @@ export const createService = (context) => ({
'rate-limit': createRateLimitService(context),
admin: createAdminService(context),
space: createSpaceService(context),
store: createStoreService(context),
subscription: createSubscriptionService(context),
upload: createUploadService(context),
ucan: createUcanService(context),
Expand Down
17 changes: 0 additions & 17 deletions packages/upload-api/src/store.js

This file was deleted.

85 changes: 0 additions & 85 deletions packages/upload-api/src/store/add.js

This file was deleted.

23 changes: 0 additions & 23 deletions packages/upload-api/src/store/get.js

This file was deleted.

29 changes: 0 additions & 29 deletions packages/upload-api/src/store/lib.js

This file was deleted.

15 changes: 0 additions & 15 deletions packages/upload-api/src/store/list.js

This file was deleted.

22 changes: 0 additions & 22 deletions packages/upload-api/src/store/remove.js

This file was deleted.

Loading

0 comments on commit d59ec88

Please sign in to comment.