Page MenuHomePhabricator

D13655.id45005.diff
No OneTemporary

D13655.id45005.diff

diff --git a/lib/facts/blob-service.js b/lib/facts/blob-service.js
--- a/lib/facts/blob-service.js
+++ b/lib/facts/blob-service.js
@@ -35,6 +35,10 @@
path: '/blob',
method: 'DELETE',
},
+ REMOVE_MULTIPLE_HOLDERS: {
+ path: '/holders',
+ method: 'DELETE',
+ },
});
const config: BlobServiceConfig = {
diff --git a/lib/types/blob-service-types.js b/lib/types/blob-service-types.js
new file mode 100644
--- /dev/null
+++ b/lib/types/blob-service-types.js
@@ -0,0 +1,87 @@
+// @flow
+
+import t, { type TInterface, type TUnion } from 'tcomb';
+
+import { tShape } from '../utils/validation-utils.js';
+
+export type BlobInfo = {
+ +blobHash: string,
+ +holder: string,
+};
+export const blobInfoValidator: TInterface<BlobInfo> = tShape<BlobInfo>({
+ blobHash: t.String,
+ holder: t.String,
+});
+
+export type HolderAssignmentResult = $ReadOnly<{
+ ...BlobInfo,
+ // `true` if adding this holder was successful.
+ // Also true when `holderAlreadyExists` is true.
+ +success: boolean,
+ // `true` when given holder already existed
+ +holderAlreadyExists: boolean,
+ // `true` if blob hash has been uploaded before.
+ +dataExists: boolean,
+}>;
+export const holderAssignmentResultValidator: TInterface<HolderAssignmentResult> =
+ tShape<HolderAssignmentResult>({
+ blobHash: t.String,
+ holder: t.String,
+ success: t.Boolean,
+ holderAlreadyExists: t.Boolean,
+ dataExists: t.Boolean,
+ });
+
+export type AssignMultipleHoldersRequest = {
+ +requests: $ReadOnlyArray<BlobInfo>,
+};
+export const assignMultipleHoldersRequestValidator: TInterface<AssignMultipleHoldersRequest> =
+ tShape<AssignMultipleHoldersRequest>({
+ requests: t.list(blobInfoValidator),
+ });
+
+export type AssignMultipleHoldersResponse = {
+ +results: $ReadOnlyArray<HolderAssignmentResult>,
+};
+export const assignMultipleHoldersResponseValidator: TInterface<AssignMultipleHoldersResponse> =
+ tShape<AssignMultipleHoldersResponse>({
+ results: t.list(holderAssignmentResultValidator),
+ });
+
+export type RemoveMultipleHolderItemsRequest = {
+ +requests: $ReadOnlyArray<BlobInfo>,
+ // Whether to instantly delete blob after last holder is removed, without
+ // waiting for cleanup. Defaults to `false` if not provided.
+ +instantDelete?: boolean,
+};
+export const removeMultipleHolderItemsRequestValidator: TInterface<RemoveMultipleHolderItemsRequest> =
+ tShape<RemoveMultipleHolderItemsRequest>({
+ requests: t.list(blobInfoValidator),
+ });
+
+export type RemoveMultipleHoldersByTagRequest = {
+ +tags: $ReadOnlyArray<string>,
+};
+export const removeMultipleHoldersByTagRequestValidator: TInterface<RemoveMultipleHoldersByTagRequest> =
+ tShape<RemoveMultipleHoldersByTagRequest>({
+ tags: t.list(t.String),
+ });
+
+export type RemoveMultipleHoldersRequest =
+ | RemoveMultipleHolderItemsRequest
+ | RemoveMultipleHoldersByTagRequest;
+export const removeMultipleHoldersRequestValidator: TUnion<RemoveMultipleHoldersRequest> =
+ t.union([
+ removeMultipleHolderItemsRequestValidator,
+ removeMultipleHoldersByTagRequestValidator,
+ ]);
+
+export type RemoveMultipleHoldersResponse = {
+ // Holder removal requests that failed server-side are returned here.
+ // This can be passed into retry request body.
+ +failedRequests: $ReadOnlyArray<BlobInfo>,
+};
+export const removeMultipleHoldersResponseValidator: TInterface<RemoveMultipleHoldersResponse> =
+ tShape<RemoveMultipleHoldersResponse>({
+ failedRequests: t.list(blobInfoValidator),
+ });

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 1:53 AM (17 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2697835
Default Alt Text
D13655.id45005.diff (3 KB)

Event Timeline