{isViewingBuckets ? (
@@ -16,8 +16,9 @@ export function FilesStatsMenu() {
)}
{isViewingABucket && (
-
{
- const p: ObjectDirectoryParams = {
- ...bucketAndKeyParamsFromPath(activeDirectoryPath),
+ let prefix = pathParams.key
+ if (fileNamePrefixFilter) {
+ prefix += fileNamePrefixFilter.startsWith('/')
+ ? fileNamePrefixFilter.slice(1)
+ : fileNamePrefixFilter
+ }
+ const p: ObjectListParams = {
+ prefix,
+ bucket: pathParams.bucket,
sortBy: sortField,
sortDir: sortDirection,
- offset,
limit,
+ delimiter: '/',
}
- if (fileNamePrefixFilter) {
- p.prefix = fileNamePrefixFilter.startsWith('/')
- ? fileNamePrefixFilter.slice(1)
- : fileNamePrefixFilter
+ if (marker) {
+ p.marker = marker
}
return p
}, [
- activeDirectoryPath,
fileNamePrefixFilter,
+ pathParams,
sortField,
sortDirection,
- offset,
+ marker,
limit,
])
- const response = useObjectDirectory({
+ const response = useObjectList({
disabled: !activeBucketName,
params,
config: {
@@ -57,9 +64,9 @@ export function useDataset() {
const objects = useMemo(
() => ({
isValidating: response.isValidating,
- data: response.data?.entries,
+ data: response.data?.objects,
}),
- [response.isValidating, response.data?.entries]
+ [response.isValidating, response.data?.objects]
)
const d = useDatasetGeneric({
@@ -69,7 +76,8 @@ export function useDataset() {
return {
limit,
- offset,
+ marker,
+ isMore: response.data?.hasMore,
response,
dataset: d.data,
refresh: response.mutate,
diff --git a/apps/renterd/contexts/filesDirectory/index.tsx b/apps/renterd/contexts/filesDirectory/index.tsx
index 20ad3ea70..a12cb9052 100644
--- a/apps/renterd/contexts/filesDirectory/index.tsx
+++ b/apps/renterd/contexts/filesDirectory/index.tsx
@@ -16,7 +16,7 @@ function useFilesDirectoryMain() {
enabledColumns,
} = useFilesManager()
- const { limit, offset, response, refresh, dataset } = useDataset()
+ const { limit, marker, isMore, response, refresh, dataset } = useDataset()
const {
onDragEnd,
@@ -104,7 +104,8 @@ function useFilesDirectoryMain() {
columns: filteredTableColumns,
refresh,
limit,
- offset,
+ marker,
+ isMore,
datasetPage,
pageCount: dataset?.length || 0,
onDragStart,
diff --git a/apps/renterd/contexts/filesFlat/dataset.tsx b/apps/renterd/contexts/filesFlat/dataset.tsx
index 60d73a594..212eb8d72 100644
--- a/apps/renterd/contexts/filesFlat/dataset.tsx
+++ b/apps/renterd/contexts/filesFlat/dataset.tsx
@@ -1,4 +1,3 @@
-import { ObjectListPayload } from '@siafoundation/renterd-types'
import { useObjectList } from '@siafoundation/renterd-react'
import { SortField } from '../filesManager/types'
import { useDataset as useDatasetGeneric } from '../filesManager/dataset'
@@ -6,6 +5,7 @@ import { useRouter } from 'next/router'
import { useMemo } from 'react'
import { useFilesManager } from '../filesManager'
import { defaultDatasetRefreshInterval } from '../../config/swr'
+import { ObjectListParams } from '@siafoundation/renterd-types'
type Props = {
sortDirection: 'asc' | 'desc'
@@ -21,22 +21,27 @@ export function useDataset({ sortDirection, sortField }: Props) {
const marker = router.query.marker as string
const params = useMemo(() => {
- const p: ObjectListPayload = {
+ let prefix = ''
+ if (fileNamePrefixFilter) {
+ prefix += fileNamePrefixFilter.startsWith('/')
+ ? fileNamePrefixFilter.slice(1)
+ : fileNamePrefixFilter
+ }
+ const p: ObjectListParams = {
+ prefix,
bucket: activeBucketName,
sortBy: sortField,
sortDir: sortDirection,
- marker,
limit,
+ delimiter: '',
}
- if (fileNamePrefixFilter) {
- p.prefix = fileNamePrefixFilter.startsWith('/')
- ? fileNamePrefixFilter
- : '/' + fileNamePrefixFilter
+ if (marker) {
+ p.marker = marker
}
return p
}, [
- activeBucketName,
fileNamePrefixFilter,
+ activeBucketName,
sortField,
sortDirection,
marker,
@@ -45,7 +50,7 @@ export function useDataset({ sortDirection, sortField }: Props) {
const response = useObjectList({
disabled: !activeBucketName,
- payload: params,
+ params,
config: {
swr: {
refreshInterval: defaultDatasetRefreshInterval,
diff --git a/apps/renterd/contexts/filesManager/dataset.tsx b/apps/renterd/contexts/filesManager/dataset.tsx
index c8af717cd..31b1d8506 100644
--- a/apps/renterd/contexts/filesManager/dataset.tsx
+++ b/apps/renterd/contexts/filesManager/dataset.tsx
@@ -1,4 +1,4 @@
-import { ObjEntry } from '@siafoundation/renterd-types'
+import { ObjectMetadata } from '@siafoundation/renterd-types'
import { sortBy, toPairs } from '@technically/lodash'
import useSWR from 'swr'
import { useContracts } from '../contracts'
@@ -16,7 +16,7 @@ type Props = {
id: string
objects: {
isValidating: boolean
- data?: ObjEntry[]
+ data?: ObjectMetadata[]
}
}
@@ -57,7 +57,7 @@ export function useDataset({ id, objects }: Props) {
}
})
} else if (objects.data || uploadsList.length) {
- objects.data?.forEach(({ name: key, size, health }) => {
+ objects.data?.forEach(({ key, size, health }) => {
const path = join(activeBucketName, key)
const name = getFilename(key)
dataMap[path] = {
diff --git a/apps/renterd/contexts/filesManager/uploads.tsx b/apps/renterd/contexts/filesManager/uploads.tsx
index 5b7f2de96..7b2ad5256 100644
--- a/apps/renterd/contexts/filesManager/uploads.tsx
+++ b/apps/renterd/contexts/filesManager/uploads.tsx
@@ -1,5 +1,5 @@
import { triggerErrorToast } from '@siafoundation/design-system'
-import { Bucket } from '@siafoundation/renterd-types'
+import { Bucket, busListObjectsRoute } from '@siafoundation/renterd-types'
import {
useBuckets,
useMultipartUploadAbort,
@@ -106,7 +106,7 @@ export function useUploads({ activeDirectoryPath }: Props) {
const key = getKeyFromPath(path)
const multipartUpload = new MultipartUpload({
file: uploadFile,
- path: key,
+ key,
bucket: bucket.name,
api: ref.current,
partSize: getMultipartUploadPartSize(
@@ -133,7 +133,7 @@ export function useUploads({ activeDirectoryPath }: Props) {
}, 1000)
)
multipartUpload.setOnComplete(async () => {
- await ref.current.mutate((key) => key.startsWith('/bus/objects'))
+ await ref.current.mutate((key) => key.startsWith(busListObjectsRoute))
ref.current.removeUpload(uploadId)
setTimeout(() => {
ref.current.checkAndStartUploads()
diff --git a/apps/renterd/contexts/uploads/index.tsx b/apps/renterd/contexts/uploads/index.tsx
index 0c2852896..d9ef85d92 100644
--- a/apps/renterd/contexts/uploads/index.tsx
+++ b/apps/renterd/contexts/uploads/index.tsx
@@ -46,7 +46,7 @@ function useUploadsMain() {
await apiBusUploadAbort.post({
payload: {
bucket: activeBucket?.name,
- path: upload.path,
+ key: upload.key,
uploadID: upload.uploadID,
},
})
@@ -59,8 +59,8 @@ function useUploadsMain() {
return (
response.data?.uploads?.map((upload) => {
const id = upload.uploadID
- const name = getFilename(upload.path)
- const fullPath = join(activeBucket?.name, upload.path)
+ const name = getFilename(upload.key)
+ const fullPath = join(activeBucket?.name, upload.key)
const localUpload = uploadsMap[id]
if (localUpload) {
{
@@ -83,7 +83,7 @@ function useUploadsMain() {
await apiBusUploadAbort.post({
payload: {
bucket: activeBucket?.name,
- path: upload.path,
+ key: upload.key,
uploadID: upload.uploadID,
},
})
diff --git a/apps/renterd/lib/multipartUpload.spec.ts b/apps/renterd/lib/multipartUpload.spec.ts
index 92434a293..53c49c381 100644
--- a/apps/renterd/lib/multipartUpload.spec.ts
+++ b/apps/renterd/lib/multipartUpload.spec.ts
@@ -62,7 +62,7 @@ describe('MultipartUpload', () => {
{ eTag: 'etag-9', partNumber: 9 },
{ eTag: 'etag-10', partNumber: 10 },
],
- path: 'test-path',
+ key: 'test-path',
uploadID: '12345',
},
})
@@ -126,7 +126,7 @@ describe('MultipartUpload', () => {
{ eTag: 'etag-9', partNumber: 9 },
{ eTag: 'etag-10', partNumber: 10 },
],
- path: 'test-path',
+ key: 'test-path',
uploadID: '12345',
},
})
@@ -184,7 +184,7 @@ describe('MultipartUpload', () => {
{ eTag: 'etag-2', partNumber: 2 },
{ eTag: 'etag-3', partNumber: 3 },
],
- path: 'test-path',
+ key: 'test-path',
uploadID: '12345',
},
})
@@ -260,7 +260,7 @@ describe('MultipartUpload', () => {
await delay(10)
await multipartUpload.abort()
expect(params.api.busUploadAbort.post).toHaveBeenCalledWith({
- payload: { bucket: 'test-bucket', path: 'test-path', uploadID: '12345' },
+ payload: { bucket: 'test-bucket', key: 'test-path', uploadID: '12345' },
})
expect(params.onComplete).not.toHaveBeenCalled()
expect(params.onError).not.toHaveBeenCalled()
@@ -281,7 +281,7 @@ function getMockedParams(params?: Partial>) {
const partSize = paramsPartSize || 1
return {
bucket: 'test-bucket',
- path: 'test-path',
+ key: 'test-path',
partSize,
maxConcurrentParts: 1,
file,
diff --git a/apps/renterd/lib/multipartUpload.ts b/apps/renterd/lib/multipartUpload.ts
index c3b15884e..c3d13496a 100644
--- a/apps/renterd/lib/multipartUpload.ts
+++ b/apps/renterd/lib/multipartUpload.ts
@@ -14,7 +14,7 @@ type ApiBusUploadAbort = ReturnType
export type MultipartParams = {
bucket: string
- path: string
+ key: string
file: File
api: {
workerUploadPart: ApiWorkerUploadPart
@@ -41,7 +41,7 @@ type UploadedPart = {
export class MultipartUpload {
// params
#bucket: string
- #path: string
+ #key: string
#file: File
#partSize: number
#maxConcurrentParts: number
@@ -75,7 +75,7 @@ export class MultipartUpload {
constructor(options: MultipartParams) {
// params
this.#bucket = options.bucket
- this.#path = options.path
+ this.#key = options.key
this.#partSize = options.partSize || 1024 * 1024 * 5
this.#maxConcurrentParts = Math.min(options.maxConcurrentParts || 5, 15)
this.#file = options.file
@@ -96,8 +96,7 @@ export class MultipartUpload {
public async create() {
const createPayload = {
bucket: this.#bucket,
- generateKey: true,
- path: this.#path,
+ key: this.#key,
}
const response = await this.#api.busUploadCreate.post({
payload: createPayload,
@@ -133,7 +132,7 @@ export class MultipartUpload {
await this.#api.busUploadAbort.post({
payload: {
bucket: this.#bucket,
- path: this.#path,
+ key: this.#key,
uploadID: this.#uploadId,
},
})
@@ -235,7 +234,7 @@ export class MultipartUpload {
try {
const payload = {
bucket: this.#bucket,
- path: this.#path,
+ key: this.#key,
uploadID: this.#uploadId,
parts: this.#uploadedParts.sort((a, b) => a.partNumber - b.partNumber),
}
@@ -280,7 +279,7 @@ export class MultipartUpload {
try {
const response = await this.#api.workerUploadPart.put({
params: {
- key: this.#path.slice(1),
+ key: this.#key.slice(1),
bucket: this.#bucket,
uploadid: this.#uploadId,
offset: partOffset,
diff --git a/libs/design-system/src/lib/utils.ts b/libs/design-system/src/lib/utils.ts
index ed9f43aba..486523124 100644
--- a/libs/design-system/src/lib/utils.ts
+++ b/libs/design-system/src/lib/utils.ts
@@ -1,9 +1,9 @@
-export function truncate(id: string, limit?: number) {
+export function truncate(id: string, limit: number, ellipsis = true) {
if (!id) {
return ''
}
if (limit && id.length > limit) {
- return `${id.slice(0, limit)}...`
+ return `${id.slice(0, limit)}${ellipsis ? '...' : ''}`
}
return `${id.slice(0, limit)}`
}
@@ -20,13 +20,9 @@ export function stripPrefix(hash: string) {
.replace(/^bid:/, '')
}
-export function getTitleId(title: string, id: string, limit?: number) {
+export function getTitleId(title: string, id: string, limit: number) {
if (id) {
- return `${title} ${humanId(id, limit)}`
+ return `${title} ${truncate(id, limit)}`
}
return `${title}`
}
-
-export function humanId(id: string, limit?: number) {
- return truncate(id, limit)
-}
diff --git a/libs/renterd-js/src/bus.ts b/libs/renterd-js/src/bus.ts
index 0a1e814b2..503d7dbea 100644
--- a/libs/renterd-js/src/bus.ts
+++ b/libs/renterd-js/src/bus.ts
@@ -121,9 +121,6 @@ import {
ObjectDeleteParams,
ObjectDeletePayload,
ObjectDeleteResponse,
- ObjectDirectoryParams,
- ObjectDirectoryPayload,
- ObjectDirectoryResponse,
ObjectListParams,
ObjectListPayload,
ObjectListResponse,
@@ -133,9 +130,6 @@ import {
ObjectRenamePayload,
ObjectRenameResponse,
ObjectResponse,
- ObjectSearchParams,
- ObjectSearchPayload,
- ObjectSearchResponse,
ObjectsStatsParams,
ObjectsStatsPayload,
ObjectsStatsResponse,
@@ -230,10 +224,8 @@ import {
busMultipartListuploadsRoute,
busMultipartPartRoute,
busObjectsKeyRoute,
- busObjectsListRoute,
busObjectsRenameRoute,
busHostsRoute,
- busSearchObjectsRoute,
busSettingKeyRoute,
busSettingsRoute,
busSlabKeyObjectsRoute,
@@ -255,6 +247,7 @@ import {
AutopilotsPayload,
AutopilotsResponse,
busWalletEventsRoute,
+ busListObjectsPrefixRoute,
} from '@siafoundation/renterd-types'
import { buildRequestHandler, initAxios } from '@siafoundation/request'
import { AxiosRequestConfig } from 'axios'
@@ -468,26 +461,16 @@ export function Bus({ api, password }: { api: string; password?: string }) {
BucketDeletePayload,
BucketDeleteResponse
>(axios, 'delete', busBucketNameRoute),
- objectDirectory: buildRequestHandler<
- ObjectDirectoryParams,
- ObjectDirectoryPayload,
- ObjectDirectoryResponse
- >(axios, 'get', busObjectsKeyRoute),
objectList: buildRequestHandler<
ObjectListParams,
ObjectListPayload,
ObjectListResponse
- >(axios, 'post', busObjectsListRoute),
+ >(axios, 'get', busListObjectsPrefixRoute),
object: buildRequestHandler(
axios,
'get',
busObjectsKeyRoute
),
- objectSearch: buildRequestHandler<
- ObjectSearchParams,
- ObjectSearchPayload,
- ObjectSearchResponse
- >(axios, 'get', busSearchObjectsRoute),
objectAdd: buildRequestHandler<
ObjectAddParams,
ObjectAddPayload,
diff --git a/libs/renterd-react/src/bus.ts b/libs/renterd-react/src/bus.ts
index 05d8821bc..4b9563eda 100644
--- a/libs/renterd-react/src/bus.ts
+++ b/libs/renterd-react/src/bus.ts
@@ -115,18 +115,13 @@ import {
ObjectDeleteParams,
ObjectDeletePayload,
ObjectDeleteResponse,
- ObjectDirectoryParams,
- ObjectDirectoryResponse,
ObjectListParams,
- ObjectListPayload,
ObjectListResponse,
ObjectParams,
ObjectRenameParams,
ObjectRenamePayload,
ObjectRenameResponse,
ObjectResponse,
- ObjectSearchParams,
- ObjectSearchResponse,
ObjectsStatsParams,
ObjectsStatsResponse,
SettingParams,
@@ -189,10 +184,8 @@ import {
busHostsHostKeyRoute,
busObjectsRoute,
busObjectsKeyRoute,
- busObjectsListRoute,
busObjectsRenameRoute,
busHostsRoute,
- busSearchObjectsRoute,
busSettingKeyRoute,
busSettingsRoute,
busStateRoute,
@@ -244,6 +237,8 @@ import {
WalletEventsParams,
WalletEventsResponse,
busWalletEventsRoute,
+ busListObjectsPrefixRoute,
+ busListObjectsRoute,
} from '@siafoundation/renterd-types'
// state
@@ -699,32 +694,16 @@ export function useBucketDelete(
)
}
-export function useObjectDirectory(
- args: HookArgsSwr
-) {
- return useGetSwr({ ...args, route: busObjectsKeyRoute })
-}
-
export function useObjectList(
- args: HookArgsWithPayloadSwr<
- ObjectListParams,
- ObjectListPayload,
- ObjectListResponse
- >
+ args: HookArgsSwr
) {
- return usePostSwr({ ...args, route: busObjectsListRoute })
+ return useGetSwr({ ...args, route: busListObjectsPrefixRoute })
}
export function useObject(args: HookArgsSwr) {
return useGetSwr({ ...args, route: busObjectsKeyRoute })
}
-export function useObjectSearch(
- args: HookArgsSwr
-) {
- return useGetSwr({ ...args, route: busSearchObjectsRoute })
-}
-
export function useObjectAdd(
args: HookArgsCallback
) {
@@ -751,7 +730,10 @@ export function useObjectDelete(
return useDeleteFunc(
{ ...args, route: busObjectsKeyRoute },
async (mutate) => {
- mutate((key) => key.startsWith(busObjectsRoute))
+ mutate(
+ (key) =>
+ key.startsWith(busObjectsRoute) || key.startsWith(busListObjectsRoute)
+ )
}
)
}
diff --git a/libs/renterd-react/src/worker.ts b/libs/renterd-react/src/worker.ts
index aba185c07..d6749294b 100644
--- a/libs/renterd-react/src/worker.ts
+++ b/libs/renterd-react/src/worker.ts
@@ -32,6 +32,8 @@ import {
workerObjectsKeyRoute,
workerRhpScanRoute,
workerStateRoute,
+ busListObjectsRoute,
+ Host,
} from '@siafoundation/renterd-types'
// state
@@ -77,7 +79,10 @@ export function useObjectUpload(
route: workerObjectsKeyRoute,
},
async (mutate) => {
- mutate((key) => key.startsWith(busObjectsRoute))
+ mutate(
+ (key) =>
+ key.startsWith(busObjectsRoute) || key.startsWith(busListObjectsRoute)
+ )
}
)
}
diff --git a/libs/renterd-types/src/bus.ts b/libs/renterd-types/src/bus.ts
index a7ec728f9..202bb9932 100644
--- a/libs/renterd-types/src/bus.ts
+++ b/libs/renterd-types/src/bus.ts
@@ -16,7 +16,7 @@ import {
Host,
HostSettings,
Obj,
- PartialSlab,
+ ObjectMetadata,
SlabSlice,
} from './types'
@@ -60,9 +60,9 @@ export const busBucketsRoute = '/bus/buckets'
export const busBucketNameRoute = '/bus/bucket/:name'
export const busBucketNamePolicyRoute = '/bus/bucket/:name/policy'
export const busObjectsRoute = '/bus/objects'
+export const busListObjectsRoute = '/bus/listobjects'
+export const busListObjectsPrefixRoute = '/bus/listobjects/:prefix'
export const busObjectsKeyRoute = '/bus/objects/:key'
-export const busObjectsListRoute = '/bus/objects/list'
-export const busSearchObjectsRoute = '/bus/search/objects'
export const busObjectsRenameRoute = '/bus/objects/rename'
export const busStatsObjectsRoute = '/bus/stats/objects'
export const busSettingRoute = '/bus/setting'
@@ -389,37 +389,21 @@ export type BucketDeleteParams = { name: string }
export type BucketDeletePayload = void
export type BucketDeleteResponse = void
-export type ObjEntry = {
- name: string
- size: number
- health: number
-}
-
-export type ObjectDirectoryParams = {
- key: string
- bucket: string
- limit?: number
+export type ObjectListParams = {
prefix?: string
- offset?: number
- sortBy?: 'name' | 'health' | 'size'
- sortDir?: 'asc' | 'desc'
-}
-export type ObjectDirectoryPayload = void
-export type ObjectDirectoryResponse = { hasMore: boolean; entries: ObjEntry[] }
-
-export type ObjectListParams = void
-export type ObjectListPayload = {
bucket: string
+ delimiter?: string
limit?: number
- prefix?: string
marker?: string
sortBy?: 'name' | 'health' | 'size'
sortDir?: 'asc' | 'desc'
+ substring?: string
}
+export type ObjectListPayload = void
export type ObjectListResponse = {
hasMore: boolean
nextMarker: string
- objects: ObjEntry[]
+ objects?: ObjectMetadata[]
}
export type ObjectParams = { key: string; bucket: string }
@@ -433,7 +417,7 @@ export type ObjectSearchParams = {
limit: number
}
export type ObjectSearchPayload = void
-export type ObjectSearchResponse = ObjEntry[]
+export type ObjectSearchResponse = ObjectMetadata[]
export type ObjectAddParams = { key: string; bucket: string }
export type ObjectAddPayload = {
@@ -522,7 +506,7 @@ export type AlertsDismissResponse = void
export type SlabObjectsParams = { key: string }
export type SlabObjectsPayload = void
-export type SlabObjectsResponse = ObjEntry[]
+export type SlabObjectsResponse = ObjectMetadata[]
// metrics
@@ -610,10 +594,11 @@ export type WalletMetricsResponse = WalletMetric[]
export type MultipartUploadCreateParams = void
export type MultipartUploadCreatePayload = {
- path: string
+ key: string
bucket: string
- generateKey: boolean
- key?: string
+ mimeType?: string
+ metadata?: Record
+ disableClientSideEncryption?: boolean
}
export type MultipartUploadCreateResponse = {
uploadID: string
@@ -626,7 +611,7 @@ export type MultipartUploadCompletePart = {
export type MultipartUploadCompleteParams = void
export type MultipartUploadCompletePayload = {
- path: string
+ key: string
bucket: string
uploadID: string
parts: MultipartUploadCompletePart[]
@@ -635,7 +620,7 @@ export type MultipartUploadCompleteResponse = void
export type MultipartUploadAbortParams = void
export type MultipartUploadAbortPayload = {
- path: string
+ key: string
bucket: string
uploadID: string
}
@@ -644,7 +629,7 @@ export type MultipartUploadAbortResponse = void
export type MultipartUploadListPartsParams = void
export type MultipartUploadListPartsPayload = {
bucket: string
- path: string
+ key: string
uploadID: string
partNumberMarker?: number
limit?: number
@@ -664,30 +649,33 @@ export type MultipartUploadListUploadsParams = void
export type MultipartUploadListUploadsPayload = {
bucket: string
prefix?: string
- pathMarker?: string
+ keyMarker?: string
uploadIDMarker?: string
limit?: number
}
+export type MultipartUploadListItem = {
+ bucket: string
+ key: string
+ encryptionKey: string
+ uploadID: string
+ createdAt: string
+}
export type MultipartUploadListUploadsResponse = {
hasMore: boolean
nextMarker: string
nextUploadIDMarker: string
- uploads?: {
- path: string
- uploadID: string
- createdAt: string
- }[]
+ uploads?: MultipartUploadListItem[]
}
export type MultipartUploadAddPartParams = void
export type MultipartUploadAddPartPayload = {
- path: string
+ key: string
bucket: string
uploadID: string
eTag: string
partNumber: number
contractSet?: string
- partialSlabs?: PartialSlab[]
+ partialSlabs?: SlabSlice[]
slices?: SlabSlice[]
usedContracts?: Contract[]
}
diff --git a/libs/renterd-types/src/types.ts b/libs/renterd-types/src/types.ts
index f8d58ee10..0db81005b 100644
--- a/libs/renterd-types/src/types.ts
+++ b/libs/renterd-types/src/types.ts
@@ -88,15 +88,9 @@ export type Sector = {
root: string
}
-export type PartialSlab = {
- key: EncryptionKey
- offset: number
- length: number
-}
-
export type Slab = {
health: number
- key: EncryptionKey
+ encryptionKey: EncryptionKey
minShards: number
// if no shards, then its a partial slab
shards?: Sector[]
@@ -108,17 +102,27 @@ export type SlabSlice = {
length: number
}
-export type Obj = {
- name: string
+export type ObjectObject = {
+ encryptionKey: EncryptionKey
+ slabs?: SlabSlice[]
+}
+
+export type ObjectMetadata = {
+ key: string
size: number
health: number
- key: EncryptionKey
- eTag: string
- mimeType: string
+ eTag?: string
modTime: string
- slabs?: SlabSlice[]
+ mimeType?: string
}
+export type ObjectUserMetadata = Record
+
+export type Obj = ObjectMetadata &
+ ObjectObject & {
+ metadata: ObjectUserMetadata
+ }
+
export type ContractSetSettings = {
default: string
}