|
@@ -8,30 +8,30 @@ export class DataObjectId extends u64 {}
|
|
|
export class StorageBucketId extends u64 {}
|
|
|
|
|
|
export type IStorageBucketsPerBagValueConstraint = {
|
|
|
- min: u64
|
|
|
- max_min_diff: u64
|
|
|
+ min: u64
|
|
|
+ max_min_diff: u64
|
|
|
}
|
|
|
|
|
|
export class StorageBucketsPerBagValueConstraint
|
|
|
- extends JoyStructDecorated({
|
|
|
- min: u64,
|
|
|
- max_min_diff: u64,
|
|
|
- })
|
|
|
- implements IStorageBucketsPerBagValueConstraint {}
|
|
|
+ extends JoyStructDecorated({
|
|
|
+ min: u64,
|
|
|
+ max_min_diff: u64,
|
|
|
+ })
|
|
|
+ implements IStorageBucketsPerBagValueConstraint {}
|
|
|
|
|
|
export type IDataObject = {
|
|
|
- accepted: bool
|
|
|
- deletion_prize: BalanceOf
|
|
|
- size: u64
|
|
|
+ accepted: bool
|
|
|
+ deletion_prize: BalanceOf
|
|
|
+ size: u64
|
|
|
}
|
|
|
|
|
|
export class DataObject
|
|
|
- extends JoyStructDecorated({
|
|
|
- accepted: bool,
|
|
|
- deletion_prize: BalanceOf,
|
|
|
- size: u64,
|
|
|
- })
|
|
|
- implements IDataObject {}
|
|
|
+ extends JoyStructDecorated({
|
|
|
+ accepted: bool,
|
|
|
+ deletion_prize: BalanceOf,
|
|
|
+ size: u64,
|
|
|
+ })
|
|
|
+ implements IDataObject {}
|
|
|
|
|
|
export class DataObjectIdSet extends JoyBTreeSet(DataObjectId) {}
|
|
|
export class DistributionBucketId extends u64 {}
|
|
@@ -40,55 +40,55 @@ export class StorageBucketIdSet extends JoyBTreeSet(StorageBucketId) {}
|
|
|
export class DistributionBucketSet extends JoyBTreeSet(DistributionBucketId) {}
|
|
|
|
|
|
export type IDynamicBagDeletionPrize = {
|
|
|
- account_id: AccountId
|
|
|
- prize: BalanceOf
|
|
|
+ account_id: AccountId
|
|
|
+ prize: BalanceOf
|
|
|
}
|
|
|
|
|
|
export class DynamicBagDeletionPrize
|
|
|
- extends JoyStructDecorated({
|
|
|
- account_id: AccountId,
|
|
|
- prize: BalanceOf,
|
|
|
- })
|
|
|
- implements IDynamicBagDeletionPrize {}
|
|
|
+ extends JoyStructDecorated({
|
|
|
+ account_id: AccountId,
|
|
|
+ prize: BalanceOf,
|
|
|
+ })
|
|
|
+ implements IDynamicBagDeletionPrize {}
|
|
|
|
|
|
export class DynamicBagDeletionPrizeRecord extends DynamicBagDeletionPrize {}
|
|
|
|
|
|
export type IBag = {
|
|
|
- objects: BTreeMap<DataObjectId, DataObject>
|
|
|
- stored_by: StorageBucketIdSet
|
|
|
- distributed_by: DistributionBucketSet
|
|
|
- deletion_prize: Option<BalanceOf>
|
|
|
+ objects: BTreeMap<DataObjectId, DataObject>
|
|
|
+ stored_by: StorageBucketIdSet
|
|
|
+ distributed_by: DistributionBucketSet
|
|
|
+ deletion_prize: Option<BalanceOf>
|
|
|
}
|
|
|
|
|
|
export class Bag
|
|
|
- extends JoyStructDecorated({
|
|
|
- objects: BTreeMap.with(DataObjectId, DataObject),
|
|
|
- stored_by: StorageBucketIdSet,
|
|
|
- distributed_by: DistributionBucketSet,
|
|
|
- deletion_prize: Option.with(BalanceOf),
|
|
|
- })
|
|
|
- implements IBag {}
|
|
|
+ extends JoyStructDecorated({
|
|
|
+ objects: BTreeMap.with(DataObjectId, DataObject),
|
|
|
+ stored_by: StorageBucketIdSet,
|
|
|
+ distributed_by: DistributionBucketSet,
|
|
|
+ deletion_prize: Option.with(BalanceOf),
|
|
|
+ })
|
|
|
+ implements IBag {}
|
|
|
|
|
|
export type IDynamicBagCreationPolicy = {
|
|
|
- numberOfStorageBuckets: u64
|
|
|
+ numberOfStorageBuckets: u64
|
|
|
}
|
|
|
|
|
|
export class DynamicBagCreationPolicy
|
|
|
- extends JoyStructDecorated({
|
|
|
- numberOfStorageBuckets: u64,
|
|
|
- })
|
|
|
- implements IDynamicBagCreationPolicy {}
|
|
|
+ extends JoyStructDecorated({
|
|
|
+ numberOfStorageBuckets: u64,
|
|
|
+ })
|
|
|
+ implements IDynamicBagCreationPolicy {}
|
|
|
|
|
|
export const DynamicBagTypeDef = {
|
|
|
- Member: Null,
|
|
|
- Channel: Null,
|
|
|
+ Member: Null,
|
|
|
+ Channel: Null,
|
|
|
} as const
|
|
|
export type DynamicBagTypeKey = keyof typeof DynamicBagTypeDef
|
|
|
export class DynamicBagType extends JoyEnum(DynamicBagTypeDef) {}
|
|
|
|
|
|
export const StaticBagIdDef = {
|
|
|
- Council: Null,
|
|
|
- WorkingGroup: WorkingGroup,
|
|
|
+ Council: Null,
|
|
|
+ WorkingGroup: WorkingGroup,
|
|
|
} as const
|
|
|
export class StaticBagId extends JoyEnum(StaticBagIdDef) {}
|
|
|
export class Static extends StaticBagId {}
|
|
@@ -97,15 +97,15 @@ export class Static extends StaticBagId {}
|
|
|
export class ChannelId extends u64 {}
|
|
|
|
|
|
export const DynamicBagIdDef = {
|
|
|
- Member: MemberId,
|
|
|
- Channel: ChannelId,
|
|
|
+ Member: MemberId,
|
|
|
+ Channel: ChannelId,
|
|
|
} as const
|
|
|
export class DynamicBagId extends JoyEnum(DynamicBagIdDef) {}
|
|
|
export class Dynamic extends DynamicBagId {}
|
|
|
|
|
|
export const BagIdDef = {
|
|
|
- Static,
|
|
|
- Dynamic,
|
|
|
+ Static,
|
|
|
+ Dynamic,
|
|
|
} as const
|
|
|
export class BagId extends JoyEnum(BagIdDef) {}
|
|
|
|
|
@@ -113,133 +113,133 @@ export class BagId extends JoyEnum(BagIdDef) {}
|
|
|
export class BagIdType extends BagId {}
|
|
|
|
|
|
export type IVoucher = {
|
|
|
- sizeLimit: u64
|
|
|
- objectsLimit: u64
|
|
|
- sizeUsed: u64
|
|
|
- objectsUsed: u64
|
|
|
+ sizeLimit: u64
|
|
|
+ objectsLimit: u64
|
|
|
+ sizeUsed: u64
|
|
|
+ objectsUsed: u64
|
|
|
}
|
|
|
|
|
|
export class Voucher
|
|
|
- extends JoyStructDecorated({
|
|
|
- sizeLimit: u64,
|
|
|
- objectsLimit: u64,
|
|
|
- sizeUsed: u64,
|
|
|
- objectsUsed: u64,
|
|
|
- })
|
|
|
- implements IVoucher {}
|
|
|
+ extends JoyStructDecorated({
|
|
|
+ sizeLimit: u64,
|
|
|
+ objectsLimit: u64,
|
|
|
+ sizeUsed: u64,
|
|
|
+ objectsUsed: u64,
|
|
|
+ })
|
|
|
+ implements IVoucher {}
|
|
|
|
|
|
export const StorageBucketOperatorStatusDef = {
|
|
|
- Missing: Null,
|
|
|
- InvitedStorageWorker: WorkerId,
|
|
|
- StorageWorker: WorkerId,
|
|
|
+ Missing: Null,
|
|
|
+ InvitedStorageWorker: WorkerId,
|
|
|
+ StorageWorker: WorkerId,
|
|
|
} as const
|
|
|
export class StorageBucketOperatorStatus extends JoyEnum(StorageBucketOperatorStatusDef) {}
|
|
|
|
|
|
export type IStorageBucket = {
|
|
|
- operator_status: StorageBucketOperatorStatus
|
|
|
- accepting_new_bags: bool
|
|
|
- voucher: Voucher
|
|
|
- metadata: Bytes
|
|
|
+ operator_status: StorageBucketOperatorStatus
|
|
|
+ accepting_new_bags: bool
|
|
|
+ voucher: Voucher
|
|
|
+ metadata: Bytes
|
|
|
}
|
|
|
|
|
|
export class StorageBucket
|
|
|
- extends JoyStructDecorated({
|
|
|
- operator_status: StorageBucketOperatorStatus,
|
|
|
- accepting_new_bags: bool,
|
|
|
- voucher: Voucher,
|
|
|
- metadata: Bytes,
|
|
|
- })
|
|
|
- implements IStorageBucket {}
|
|
|
+ extends JoyStructDecorated({
|
|
|
+ operator_status: StorageBucketOperatorStatus,
|
|
|
+ accepting_new_bags: bool,
|
|
|
+ voucher: Voucher,
|
|
|
+ metadata: Bytes,
|
|
|
+ })
|
|
|
+ implements IStorageBucket {}
|
|
|
|
|
|
export type IDataObjectCreationParameters = {
|
|
|
- size: u64
|
|
|
- ipfsContentId: Bytes
|
|
|
+ size: u64
|
|
|
+ ipfsContentId: Bytes
|
|
|
}
|
|
|
|
|
|
export class DataObjectCreationParameters
|
|
|
- extends JoyStructDecorated({
|
|
|
- size: u64,
|
|
|
- ipfsContentId: Bytes,
|
|
|
- })
|
|
|
- implements IDataObjectCreationParameters {}
|
|
|
+ extends JoyStructDecorated({
|
|
|
+ size: u64,
|
|
|
+ ipfsContentId: Bytes,
|
|
|
+ })
|
|
|
+ implements IDataObjectCreationParameters {}
|
|
|
|
|
|
export type IUploadParameters = {
|
|
|
- authenticationKey: Bytes
|
|
|
- bagId: BagId
|
|
|
- objectCreationList: Vec<DataObjectCreationParameters>
|
|
|
- deletionPrizeSourceAccountId: AccountId
|
|
|
- expectedDataSizeFee: BalanceOf
|
|
|
+ authenticationKey: Bytes
|
|
|
+ bagId: BagId
|
|
|
+ objectCreationList: Vec<DataObjectCreationParameters>
|
|
|
+ deletionPrizeSourceAccountId: AccountId
|
|
|
+ expectedDataSizeFee: BalanceOf
|
|
|
}
|
|
|
|
|
|
export class UploadParameters
|
|
|
- extends JoyStructDecorated({
|
|
|
- authenticationKey: Bytes,
|
|
|
- bagId: BagId,
|
|
|
- objectCreationList: Vec.with(DataObjectCreationParameters),
|
|
|
- deletionPrizeSourceAccountId: AccountId,
|
|
|
- expectedDataSizeFee: BalanceOf,
|
|
|
- })
|
|
|
- implements IUploadParameters {}
|
|
|
+ extends JoyStructDecorated({
|
|
|
+ authenticationKey: Bytes,
|
|
|
+ bagId: BagId,
|
|
|
+ objectCreationList: Vec.with(DataObjectCreationParameters),
|
|
|
+ deletionPrizeSourceAccountId: AccountId,
|
|
|
+ expectedDataSizeFee: BalanceOf,
|
|
|
+ })
|
|
|
+ implements IUploadParameters {}
|
|
|
|
|
|
export class Cid extends Bytes {}
|
|
|
export class ContentIdSet extends BTreeSet.with(Cid) {}
|
|
|
|
|
|
export type IDistributionBucket = {
|
|
|
- accepting_new_bags: bool
|
|
|
- distributing: bool
|
|
|
- pending_invitations: BTreeSet<WorkerId>
|
|
|
- operators: BTreeSet<WorkerId>
|
|
|
- assigned_bags: u64
|
|
|
+ accepting_new_bags: bool
|
|
|
+ distributing: bool
|
|
|
+ pending_invitations: BTreeSet<WorkerId>
|
|
|
+ operators: BTreeSet<WorkerId>
|
|
|
+ assigned_bags: u64
|
|
|
}
|
|
|
|
|
|
export class DistributionBucket
|
|
|
- extends JoyStructDecorated({
|
|
|
- accepting_new_bags: bool,
|
|
|
- distributing: bool,
|
|
|
- pending_invitations: BTreeSet.with(WorkerId),
|
|
|
- operators: BTreeSet.with(WorkerId),
|
|
|
- assigned_bags: u64,
|
|
|
- })
|
|
|
- implements IDistributionBucket {}
|
|
|
+ extends JoyStructDecorated({
|
|
|
+ accepting_new_bags: bool,
|
|
|
+ distributing: bool,
|
|
|
+ pending_invitations: BTreeSet.with(WorkerId),
|
|
|
+ operators: BTreeSet.with(WorkerId),
|
|
|
+ assigned_bags: u64,
|
|
|
+ })
|
|
|
+ implements IDistributionBucket {}
|
|
|
|
|
|
export type IDistributionBucketFamily = {
|
|
|
- distribution_buckets: BTreeMap<DistributionBucketId, DistributionBucket>
|
|
|
+ distribution_buckets: BTreeMap<DistributionBucketId, DistributionBucket>
|
|
|
}
|
|
|
|
|
|
export class DistributionBucketFamily
|
|
|
- extends JoyStructDecorated({
|
|
|
- distribution_buckets: BTreeMap.with(DistributionBucketId, DistributionBucket),
|
|
|
- })
|
|
|
- implements IDistributionBucketFamily {}
|
|
|
+ extends JoyStructDecorated({
|
|
|
+ distribution_buckets: BTreeMap.with(DistributionBucketId, DistributionBucket),
|
|
|
+ })
|
|
|
+ implements IDistributionBucketFamily {}
|
|
|
|
|
|
export const storageTypes: RegistryTypes = {
|
|
|
- StorageBucketId,
|
|
|
- StorageBucketsPerBagValueConstraint,
|
|
|
- DataObjectId,
|
|
|
- DynamicBagId,
|
|
|
- Voucher,
|
|
|
- DynamicBagType,
|
|
|
- DynamicBagCreationPolicy,
|
|
|
- DynamicBagDeletionPrize,
|
|
|
- DynamicBagDeletionPrizeRecord,
|
|
|
- Bag,
|
|
|
- StorageBucket,
|
|
|
- StaticBagId,
|
|
|
- Static,
|
|
|
- Dynamic,
|
|
|
- BagId,
|
|
|
- DataObjectCreationParameters,
|
|
|
- BagIdType,
|
|
|
- UploadParameters,
|
|
|
- StorageBucketIdSet,
|
|
|
- DataObjectIdSet,
|
|
|
- ContentIdSet,
|
|
|
- Cid,
|
|
|
- StorageBucketOperatorStatus,
|
|
|
- DataObject,
|
|
|
- DistributionBucketId,
|
|
|
- DistributionBucketFamilyId,
|
|
|
- DistributionBucket,
|
|
|
- DistributionBucketFamily,
|
|
|
+ StorageBucketId,
|
|
|
+ StorageBucketsPerBagValueConstraint,
|
|
|
+ DataObjectId,
|
|
|
+ DynamicBagId,
|
|
|
+ Voucher,
|
|
|
+ DynamicBagType,
|
|
|
+ DynamicBagCreationPolicy,
|
|
|
+ DynamicBagDeletionPrize,
|
|
|
+ DynamicBagDeletionPrizeRecord,
|
|
|
+ Bag,
|
|
|
+ StorageBucket,
|
|
|
+ StaticBagId,
|
|
|
+ Static,
|
|
|
+ Dynamic,
|
|
|
+ BagId,
|
|
|
+ DataObjectCreationParameters,
|
|
|
+ BagIdType,
|
|
|
+ UploadParameters,
|
|
|
+ StorageBucketIdSet,
|
|
|
+ DataObjectIdSet,
|
|
|
+ ContentIdSet,
|
|
|
+ Cid,
|
|
|
+ StorageBucketOperatorStatus,
|
|
|
+ DataObject,
|
|
|
+ DistributionBucketId,
|
|
|
+ DistributionBucketFamilyId,
|
|
|
+ DistributionBucket,
|
|
|
+ DistributionBucketFamily,
|
|
|
}
|
|
|
export default storageTypes
|