reduct-js
Version:
ReductStore Client SDK for Javascript/NodeJS/Typescript
65 lines (64 loc) • 1.66 kB
JavaScript
/**
* Replication settings
*/
export class OriginalReplicationSettings {
constructor() {
this.src_bucket = "";
this.dst_bucket = "";
this.dst_host = "";
this.dst_token = "";
this.entries = [];
}
}
/**
* Replication settings
*/
export class ReplicationSettings {
constructor() {
/**
* Source bucket. Must exist.
*/
this.srcBucket = "";
/**
* Destination bucket. Must exist.
*/
this.dstBucket = "";
/**
* Destination host. Must exist.
*/
this.dstHost = "";
/**
* Destination token. Must have write access to the destination bucket.
*/
this.dstToken = "";
/**
* List of entries to replicate. If empty, all entries are replicated. Wildcards are supported.
*/
this.entries = [];
}
static parse(data) {
return {
srcBucket: data.src_bucket,
dstBucket: data.dst_bucket,
dstHost: data.dst_host,
dstToken: data.dst_token,
include: data.include,
exclude: data.exclude,
entries: data.entries,
eachS: data.each_s,
eachN: data.each_n ? BigInt(data.each_n) : data.each_n,
when: data.when,
};
}
static serialize(data) {
return {
src_bucket: data.srcBucket,
dst_bucket: data.dstBucket,
dst_host: data.dstHost,
dst_token: data.dstToken,
each_s: data.eachS,
each_n: data.eachN,
...data,
};
}
}