mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-24 16:23:12 +09:00
Change abstract class name
This commit is contained in:
1 file changed
+6
-6
@@ -51,7 +51,7 @@ export class JsonDatastoreProvider<
|
|||||||
> extends DatastoreProvider<K, V> {
|
> extends DatastoreProvider<K, V> {
|
||||||
constructor(
|
constructor(
|
||||||
private filePath: string,
|
private filePath: string,
|
||||||
private fromJson: (json: J) => V,
|
private fromJson: (json: J) => V = v => v as any,
|
||||||
private migrations: (rawJson: Record<DatastoreKey, unknown>) => Record<DatastoreKey, J> = v => v as any,
|
private migrations: (rawJson: Record<DatastoreKey, unknown>) => Record<DatastoreKey, J> = v => v as any,
|
||||||
private finalise: (obj: V) => V = v => v,
|
private finalise: (obj: V) => V = v => v,
|
||||||
) {
|
) {
|
||||||
@@ -92,7 +92,7 @@ export class JsonIdDatastoreProvider<
|
|||||||
> extends DatastoreProvider<K, V> {
|
> extends DatastoreProvider<K, V> {
|
||||||
constructor(
|
constructor(
|
||||||
private filePath: string,
|
private filePath: string,
|
||||||
private fromJson: (json: J) => V,
|
private fromJson: (json: J) => V = v => v as any,
|
||||||
private migrations: (rawJson: Array<unknown>) => Array<J> = v => v as any,
|
private migrations: (rawJson: Array<unknown>) => Array<J> = v => v as any,
|
||||||
private finalise: (obj: V) => V = v => v,
|
private finalise: (obj: V) => V = v => v,
|
||||||
) {
|
) {
|
||||||
@@ -129,7 +129,7 @@ export class JsonIdDatastoreProvider<
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Implements a similar interface to a map
|
// Implements a similar interface to a map
|
||||||
export abstract class BaseDatastore<
|
export abstract class Datastore<
|
||||||
K extends DatastoreKey,
|
K extends DatastoreKey,
|
||||||
V extends DatastoreValue,
|
V extends DatastoreValue,
|
||||||
> extends EventEmitter {
|
> extends EventEmitter {
|
||||||
@@ -196,10 +196,10 @@ export abstract class BaseDatastore<
|
|||||||
}
|
}
|
||||||
|
|
||||||
// General key value mapping which can be saved and loaded with the file system
|
// General key value mapping which can be saved and loaded with the file system
|
||||||
export class Datastore<
|
export class KeyValueDatastore<
|
||||||
K extends DatastoreKey,
|
K extends DatastoreKey,
|
||||||
V extends DatastoreValue,
|
V extends DatastoreValue,
|
||||||
> extends BaseDatastore<K, V> {
|
> extends Datastore<K, V> {
|
||||||
// Set the value in the datastore, be careful of race conditions if you await any functions before calling set
|
// Set the value in the datastore, be careful of race conditions if you await any functions before calling set
|
||||||
set(key: K, value: V) {
|
set(key: K, value: V) {
|
||||||
this.data.set(key, value);
|
this.data.set(key, value);
|
||||||
@@ -236,7 +236,7 @@ export class Datastore<
|
|||||||
// A special implementation of the datastore to work directly with subscribable values
|
// A special implementation of the datastore to work directly with subscribable values
|
||||||
export class SubscribableDatastore<
|
export class SubscribableDatastore<
|
||||||
V extends SubscribableValue,
|
V extends SubscribableValue,
|
||||||
> extends BaseDatastore<V["id"], V> {
|
> extends Datastore<V["id"], V> {
|
||||||
// Set the value in the datastore, be careful of race conditions if you await any functions before calling set
|
// Set the value in the datastore, be careful of race conditions if you await any functions before calling set
|
||||||
set(value: V) {
|
set(value: V) {
|
||||||
this.data.set(value.id, value);
|
this.data.set(value.id, value);
|
||||||
|
|||||||
Reference in new issue
Block a user