diff --git a/apps/renterd/components/Files/FilesCmd/FilesSearchCmd/index.tsx b/apps/renterd/components/Files/FilesCmd/FilesSearchCmd/index.tsx index e68dd67a4..3b4153d9b 100644 --- a/apps/renterd/components/Files/FilesCmd/FilesSearchCmd/index.tsx +++ b/apps/renterd/components/Files/FilesCmd/FilesSearchCmd/index.tsx @@ -1,6 +1,6 @@ import { CommandGroup, CommandItemSearch } from '../../../CmdRoot/Item' import { Page } from '../../../CmdRoot/types' -import { useObjectList } from '@siafoundation/renterd-react' +import { useObjects } from '@siafoundation/renterd-react' import { isDirectory } from '../../../../lib/paths' import { Text } from '@siafoundation/design-system' import { Document16, FolderIcon } from '@siafoundation/react-icons' @@ -31,7 +31,7 @@ export function FilesSearchCmd({ useFilesManager() const onSearchPage = currentPage?.namespace === filesSearchPage.namespace const searchBucket = activeBucket || 'default' - const results = useObjectList({ + const results = useObjects({ disabled: !onSearchPage, params: { bucket: searchBucket, diff --git a/apps/renterd/contexts/filesDirectory/dataset.tsx b/apps/renterd/contexts/filesDirectory/dataset.tsx index 928761f04..9fdf32e7d 100644 --- a/apps/renterd/contexts/filesDirectory/dataset.tsx +++ b/apps/renterd/contexts/filesDirectory/dataset.tsx @@ -1,11 +1,11 @@ -import { useObjectList } from '@siafoundation/renterd-react' +import { useObjects } from '@siafoundation/renterd-react' import { useDataset as useDatasetGeneric } from '../filesManager/dataset' import { bucketAndKeyParamsFromPath } from '../../lib/paths' import { useRouter } from 'next/router' import { useMemo } from 'react' import { useFilesManager } from '../filesManager' import { defaultDatasetRefreshInterval } from '../../config/swr' -import { ObjectListParams } from '@siafoundation/renterd-types' +import { ObjectsParams } from '@siafoundation/renterd-types' const defaultLimit = 50 @@ -30,7 +30,7 @@ export function useDataset() { ? fileNamePrefixFilter.slice(1) : fileNamePrefixFilter } - const p: ObjectListParams = { + const p: ObjectsParams = { prefix, bucket: pathParams.bucket, sortBy: sortField, @@ -51,7 +51,7 @@ export function useDataset() { limit, ]) - const response = useObjectList({ + const response = useObjects({ disabled: !activeBucketName, params, config: { diff --git a/apps/renterd/contexts/filesFlat/dataset.tsx b/apps/renterd/contexts/filesFlat/dataset.tsx index 212eb8d72..60e86adfb 100644 --- a/apps/renterd/contexts/filesFlat/dataset.tsx +++ b/apps/renterd/contexts/filesFlat/dataset.tsx @@ -1,11 +1,11 @@ -import { useObjectList } from '@siafoundation/renterd-react' +import { useObjects } from '@siafoundation/renterd-react' import { SortField } from '../filesManager/types' import { useDataset as useDatasetGeneric } from '../filesManager/dataset' import { useRouter } from 'next/router' import { useMemo } from 'react' import { useFilesManager } from '../filesManager' import { defaultDatasetRefreshInterval } from '../../config/swr' -import { ObjectListParams } from '@siafoundation/renterd-types' +import { ObjectsParams } from '@siafoundation/renterd-types' type Props = { sortDirection: 'asc' | 'desc' @@ -27,7 +27,7 @@ export function useDataset({ sortDirection, sortField }: Props) { ? fileNamePrefixFilter.slice(1) : fileNamePrefixFilter } - const p: ObjectListParams = { + const p: ObjectsParams = { prefix, bucket: activeBucketName, sortBy: sortField, @@ -48,7 +48,7 @@ export function useDataset({ sortDirection, sortField }: Props) { limit, ]) - const response = useObjectList({ + const response = useObjects({ disabled: !activeBucketName, params, config: { diff --git a/apps/renterd/contexts/filesManager/uploads.tsx b/apps/renterd/contexts/filesManager/uploads.tsx index 4fbc8643c..33deb0215 100644 --- a/apps/renterd/contexts/filesManager/uploads.tsx +++ b/apps/renterd/contexts/filesManager/uploads.tsx @@ -8,7 +8,7 @@ import { useMultipartUploadPart, useSettingsUpload, } from '@siafoundation/renterd-react' -import { Bucket, busListObjectsRoute } from '@siafoundation/renterd-types' +import { Bucket, busObjectsRoute } from '@siafoundation/renterd-types' import { MiBToBytes, minutesInMilliseconds } from '@siafoundation/units' import { throttle } from '@technically/lodash' import { useCallback, useEffect, useMemo, useRef, useState } from 'react' @@ -133,7 +133,7 @@ export function useUploads({ activeDirectoryPath }: Props) { }, 1000) ) multipartUpload.setOnComplete(async () => { - await ref.current.mutate((key) => key.startsWith(busListObjectsRoute)) + await ref.current.mutate((key) => key.startsWith(busObjectsRoute)) ref.current.removeUpload(uploadId) setTimeout(() => { ref.current.checkAndStartUploads() diff --git a/internal/cluster/go.mod b/internal/cluster/go.mod index dd336a72c..26fd8b08f 100644 --- a/internal/cluster/go.mod +++ b/internal/cluster/go.mod @@ -3,7 +3,7 @@ module go.sia.tech/web/cluster go 1.23.0 require ( - go.sia.tech/cluster v0.0.0-20240916165251-0f09676f19ad + go.sia.tech/cluster v0.0.0-20240924203221-6c140b264895 go.sia.tech/core v0.4.6 go.sia.tech/coreutils v0.3.2 go.uber.org/zap v1.27.0 @@ -33,7 +33,7 @@ require ( go.sia.tech/hostd v1.1.3-0.20240903081107-6e044db95238 // indirect go.sia.tech/jape v0.12.1 // indirect go.sia.tech/mux v1.2.0 // indirect - go.sia.tech/renterd v1.1.0-beta.2.0.20240916134118-61ab4646ef37 // indirect + go.sia.tech/renterd v1.1.0-beta.4.0.20240924124211-9a4e6a3aab98 // indirect go.sia.tech/walletd v0.8.1-0.20240830193535-90d18cf2393c // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.27.0 // indirect diff --git a/internal/cluster/go.sum b/internal/cluster/go.sum index 13358e222..08f0d0064 100644 --- a/internal/cluster/go.sum +++ b/internal/cluster/go.sum @@ -11,8 +11,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/gabriel-vasile/mimetype v1.4.5 h1:J7wGKdGu33ocBOhGy0z653k/lFKLFDPJMG8Gql0kxn4= github.com/gabriel-vasile/mimetype v1.4.5/go.mod h1:ibHel+/kbxn9x2407k1izTA1S81ku1z/DlgOW2QE0M4= -github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= -github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= @@ -40,10 +38,6 @@ github.com/mattn/go-sqlite3 v1.14.23 h1:gbShiuAP1W5j9UOksQ06aiiqPMxYecovVGwmTxWt github.com/mattn/go-sqlite3 v1.14.23/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= -github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= -github.com/minio/minio-go/v7 v7.0.76 h1:9nxHH2XDai61cT/EFhyIw/wW4vJfpPNvl7lSFpRt+Ng= -github.com/minio/minio-go/v7 v7.0.76/go.mod h1:AVM3IUN6WwKzmwBxVdjzhH8xq+f57JSbbvzqvUzR6eg= github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE= github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -59,8 +53,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0= go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I= -go.sia.tech/cluster v0.0.0-20240916165251-0f09676f19ad h1:Grq6CclFRaYz8nPG3qYetPH6jYRiAgI8kFFR+U8bQM4= -go.sia.tech/cluster v0.0.0-20240916165251-0f09676f19ad/go.mod h1:2F+rb7oYoOX/584xR1s4eDRlBN7xmYQlm04V76EH6L4= +go.sia.tech/cluster v0.0.0-20240924203221-6c140b264895 h1:w6B8UG81XnKPiDheqTulctR7itjihOMK9q57gY5vEjk= +go.sia.tech/cluster v0.0.0-20240924203221-6c140b264895/go.mod h1:tmQVXHTsEC8fEEi8qkqvEmUMSABchg6fUf8UqM/XkE8= go.sia.tech/core v0.4.6 h1:QLm97a7GWBonfnMEOokqWRAqsWCUPL7kzo6k3Adwx8E= go.sia.tech/core v0.4.6/go.mod h1:Zuq0Tn2aIXJyO0bjGu8cMeVWe+vwQnUfZhG1LCmjD5c= go.sia.tech/coreutils v0.3.2 h1:3gJqvs18n1FVZmcrnfIYyzS+rBu06OtIscDDAfUAYQI= @@ -73,8 +67,8 @@ go.sia.tech/jape v0.12.1 h1:xr+o9V8FO8ScRqbSaqYf9bjj1UJ2eipZuNcI1nYousU= go.sia.tech/jape v0.12.1/go.mod h1:wU+h6Wh5olDjkPXjF0tbZ1GDgoZ6VTi4naFw91yyWC4= go.sia.tech/mux v1.2.0 h1:ofa1Us9mdymBbGMY2XH/lSpY8itFsKIo/Aq8zwe+GHU= go.sia.tech/mux v1.2.0/go.mod h1:Yyo6wZelOYTyvrHmJZ6aQfRoer3o4xyKQ4NmQLJrBSo= -go.sia.tech/renterd v1.1.0-beta.2.0.20240916134118-61ab4646ef37 h1:OLgL41FjtaA13ZrL6V6v6zHaiFvcjmV9LfW055zXWCE= -go.sia.tech/renterd v1.1.0-beta.2.0.20240916134118-61ab4646ef37/go.mod h1:OvnYfShl7wpNIJQ4oJqAYURapS7ZUz+aDY/1MxIcGsQ= +go.sia.tech/renterd v1.1.0-beta.4.0.20240924124211-9a4e6a3aab98 h1:pFS8D7Zq0nrFVYbO9X4PAn5XQAhjaiZ6hlUJBKZDlJM= +go.sia.tech/renterd v1.1.0-beta.4.0.20240924124211-9a4e6a3aab98/go.mod h1:SYRD/Xs7JHpdnhQ8VWMNZpNu63x6G+g0kaJfdSFTGhw= go.sia.tech/walletd v0.8.1-0.20240830193535-90d18cf2393c h1:auulu0mwWRJK+OZRKoo+PQJNGFGubP2XGb8H4IWt2mc= go.sia.tech/walletd v0.8.1-0.20240830193535-90d18cf2393c/go.mod h1:B5p/myztKW86MaL69hT3wfnuzhLW3CZCWQ2WJiLqbbU= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= diff --git a/libs/renterd-js/src/bus.ts b/libs/renterd-js/src/bus.ts index 79c656f9e..d26ab6562 100644 --- a/libs/renterd-js/src/bus.ts +++ b/libs/renterd-js/src/bus.ts @@ -471,7 +471,7 @@ export function Bus({ api, password }: { api: string; password?: string }) { BucketDeletePayload, BucketDeleteResponse >(axios, 'delete', busBucketNameRoute), - objectList: buildRequestHandler< + objects: buildRequestHandler< ObjectsParams, ObjectsPayload, ObjectsResponse diff --git a/libs/renterd-js/src/index.spec.ts b/libs/renterd-js/src/index.spec.ts index 4e8488a75..b8f5be998 100644 --- a/libs/renterd-js/src/index.spec.ts +++ b/libs/renterd-js/src/index.spec.ts @@ -48,7 +48,7 @@ describe('renterd-js', () => { const bucket = 'default' const name = 'test.txt' const fileKey = `directory/${name}` - const url = `/worker/objects/${fileKey}?bucket=${bucket}` + const url = `/worker/object/${fileKey}?bucket=${bucket}` const fullUrl = `${api}${url}` mock.onPut(fullUrl).reply((config) => { diff --git a/libs/renterd-js/src/worker.ts b/libs/renterd-js/src/worker.ts index b3268e1d8..98b548640 100644 --- a/libs/renterd-js/src/worker.ts +++ b/libs/renterd-js/src/worker.ts @@ -19,7 +19,7 @@ import { WorkerStateResponse, workerAccountIdResetdriftRoute, workerMultipartKeyRoute, - workerObjectsKeyRoute, + workerObjectKeyRoute, workerRhpScanRoute, workerStateRoute, } from '@siafoundation/renterd-types' @@ -38,7 +38,7 @@ export function Worker({ api, password }: { api: string; password?: string }) { ObjectDownloadParams, ObjectDownloadPayload, ObjectDownloadResponse - >(axios, 'get', workerObjectsKeyRoute, { + >(axios, 'get', workerObjectKeyRoute, { config: { responseType: 'blob', }, @@ -47,7 +47,7 @@ export function Worker({ api, password }: { api: string; password?: string }) { ObjectUploadParams, ObjectUploadPayload, ObjectUploadResponse - >(axios, 'put', workerObjectsKeyRoute, { + >(axios, 'put', workerObjectKeyRoute, { config: { headers: { 'Content-Type': 'multipart/form-data', diff --git a/libs/renterd-react/src/bus.ts b/libs/renterd-react/src/bus.ts index 6ef8a11c8..52bb41290 100644 --- a/libs/renterd-react/src/bus.ts +++ b/libs/renterd-react/src/bus.ts @@ -702,9 +702,7 @@ export function useBucketDelete( ) } -export function useObjectList( - args: HookArgsSwr -) { +export function useObjects(args: HookArgsSwr) { return useGetSwr({ ...args, route: busObjectsPrefixRoute }) } diff --git a/libs/renterd-react/src/worker.ts b/libs/renterd-react/src/worker.ts index b23ed40c5..bdb3927a1 100644 --- a/libs/renterd-react/src/worker.ts +++ b/libs/renterd-react/src/worker.ts @@ -29,10 +29,9 @@ import { busHostsRoute, workerAccountIdResetdriftRoute, workerMultipartKeyRoute, - workerObjectsKeyRoute, + workerObjectKeyRoute, workerRhpScanRoute, workerStateRoute, - busObjectsRoute, Host, } from '@siafoundation/renterd-types' @@ -54,7 +53,7 @@ export function useObjectDownloadFunc( ObjectDownloadResponse > ) { - return useGetDownloadFunc({ ...args, route: workerObjectsKeyRoute }) + return useGetDownloadFunc({ ...args, route: workerObjectKeyRoute }) } export function useObjectUpload( @@ -76,7 +75,7 @@ export function useObjectUpload( }, }, }, - route: workerObjectsKeyRoute, + route: workerObjectKeyRoute, }, async (mutate) => { mutate((key) => key.startsWith(busObjectsRoute)) diff --git a/libs/renterd-types/src/bus.ts b/libs/renterd-types/src/bus.ts index f059317b6..911449fe3 100644 --- a/libs/renterd-types/src/bus.ts +++ b/libs/renterd-types/src/bus.ts @@ -399,7 +399,7 @@ export type BucketDeletePayload = void export type BucketDeleteResponse = void export type ObjectsParams = { - bucket: string + bucket?: string prefix?: string delimiter?: string limit?: number @@ -407,7 +407,7 @@ export type ObjectsParams = { sortBy?: 'name' | 'health' | 'size' sortDir?: 'asc' | 'desc' substring?: string - slabEncryptionKey: string + slabEncryptionKey?: string } export type ObjectsPayload = void export type ObjectsResponse = { diff --git a/libs/renterd-types/src/worker.ts b/libs/renterd-types/src/worker.ts index f01bc523f..155b530dd 100644 --- a/libs/renterd-types/src/worker.ts +++ b/libs/renterd-types/src/worker.ts @@ -2,7 +2,7 @@ import { HostSettings } from './types' import { BusStateResponse } from './bus' export const workerStateRoute = '/worker/state' -export const workerObjectsKeyRoute = '/worker/objects/:key' +export const workerObjectKeyRoute = '/worker/object/:key' export const workerMultipartKeyRoute = '/worker/multipart/:key' export const workerRhpScanRoute = '/worker/rhp/scan' export const workerAccountIdResetdriftRoute = '/worker/account/:id/resetdrift'