import type { BackendRequest, BucketManagementBackend } from '../backends'; import { BucketSettings, IBucketSettings, ICreateBucketSettings } from '../bucketmanager'; import type { BucketAdminServiceClient } from './generated/couchbase/admin/bucket/v1/BucketAdminService'; import type { CreateBucketRequest as CreateBucketRequestPb } from './generated/couchbase/admin/bucket/v1/CreateBucketRequest'; import type { _couchbase_admin_bucket_v1_ListBucketsResponse_Bucket__Output as ListedBucketPb, ListBucketsResponse__Output as ListBucketsResponsePb } from './generated/couchbase/admin/bucket/v1/ListBucketsResponse'; import type { UpdateBucketRequest as UpdateBucketRequestPb } from './generated/couchbase/admin/bucket/v1/UpdateBucketRequest'; import type { Couchbase2Channel, Couchbase2Op } from './requestcontext'; /** * @internal */ export declare const BUCKET_GET_ALL: Couchbase2Op; /** * @internal */ export declare const BUCKET_GET: Couchbase2Op; /** * @internal */ export declare const BUCKET_CREATE: Couchbase2Op; /** * @internal */ export declare const BUCKET_UPDATE: Couchbase2Op; /** * @internal */ export declare const BUCKET_DROP: Couchbase2Op; /** * @internal */ export declare const BUCKET_FLUSH: Couchbase2Op; /** * Throws `FeatureNotAvailableError` for a memcached bucket and for a number * of vBuckets, which the gateway's request has no field for. * * @internal */ export declare function createBucketRequestToProto(settings: ICreateBucketSettings): CreateBucketRequestPb; /** * The settings fixed at creation are left out rather than refused, because * the settings `getBucket` returns carry them and updating those is the * usual way to change one setting. * * @internal */ export declare function updateBucketRequestToProto(settings: Partial & Pick): UpdateBucketRequestPb; /** * Throws `FeatureNotAvailableError` if `bucketName` is listed with a minimum * durability level. The gateway has no level for none and keeps a bucket's * level when an update leaves it out (ING-2862), so an update asking for none * would succeed and leave the level in place. A bucket with no level, or one * not listed, is left to the update itself. * * @internal */ export declare function checkNoDurabilityToClear(resp: ListBucketsResponsePb, bucketName: string): void; /** * One listed bucket's settings, read as a classic connection reads them. No * minimum durability level means none. History settings are read for magma * only: the gateway lists zeros for couchstore, which the server refuses if * an update sends them back. A magma bucket has no replica indexes setting, * though the gateway lists it as off. * * @internal */ export declare function bucketSettingsFromProto(bucket: ListedBucketPb): BucketSettings; /** * Bucket management over the gateway's `BucketAdminService`. The gateway * has no request for one bucket, so `getBucket` reads it from the listing. * * @internal */ export declare class Couchbase2Buckets implements BucketManagementBackend { private readonly _channel; private readonly _client; constructor(channel: Couchbase2Channel, client: BucketAdminServiceClient); /** * Creates a bucket with `BucketAdminService.CreateBucket`. */ createBucket(settings: ICreateBucketSettings, req: BackendRequest): Promise; /** * Updates a bucket with `BucketAdminService.UpdateBucket`. An update asking * for no minimum durability level lists the buckets first, to refuse it * for a bucket that has one; see {@link checkNoDurabilityToClear}. The * listing is a request of its own, a read, and the update is given what is * left of the timeout after it, so that running out of time before the * update is sent is not ambiguous. */ updateBucket(settings: Partial & Pick, req: BackendRequest): Promise; /** * Drops a bucket with `BucketAdminService.DeleteBucket`. */ dropBucket(bucketName: string, req: BackendRequest): Promise; /** * Reads one bucket's settings from `BucketAdminService.ListBuckets`. A * bucket missing from the listing raises `BucketNotFoundError`. */ getBucket(bucketName: string, req: BackendRequest): Promise; /** * Lists every bucket's settings with `BucketAdminService.ListBuckets`. */ getAllBuckets(req: BackendRequest): Promise; /** * Flushes a bucket with `BucketAdminService.FlushBucket`. */ flushBucket(bucketName: string, req: BackendRequest): Promise; /** * Lists every bucket with `BucketAdminService.ListBuckets`, under `ctx`. */ private _list; }