reduct-js
Version:
ReductStore Client SDK for Javascript/NodeJS/Typescript
34 lines (33 loc) • 1.12 kB
JavaScript
//#region src/messages/BucketSettings.ts
var QuotaType = /* @__PURE__ */ function(QuotaType) {
QuotaType[QuotaType["NONE"] = 0] = "NONE";
QuotaType[QuotaType["FIFO"] = 1] = "FIFO";
QuotaType[QuotaType["HARD"] = 2] = "HARD";
return QuotaType;
}({});
/**
* Represents bucket settings
*/
var BucketSettings = class {
static parse(data) {
const { max_block_size, max_block_records, quota_type, quota_size } = data;
return {
maxBlockSize: max_block_size !== void 0 ? BigInt(max_block_size) : void 0,
maxBlockRecords: max_block_records !== void 0 ? BigInt(max_block_records) : void 0,
quotaType: quota_type !== void 0 ? QuotaType[quota_type] : void 0,
quotaSize: quota_size !== void 0 ? BigInt(quota_size) : void 0
};
}
static serialize(settings) {
const { maxBlockSize, maxBlockRecords, quotaType, quotaSize } = settings;
return {
max_block_size: maxBlockSize,
max_block_records: maxBlockRecords,
quota_type: quotaType !== void 0 ? QuotaType[quotaType] : void 0,
quota_size: quotaSize
};
}
};
//#endregion
exports.BucketSettings = BucketSettings;
exports.QuotaType = QuotaType;