@casual-simulation/aux-common
Version:
Common library for AUX projects
53 lines • 2.09 kB
TypeScript
import type { MemoryPartition, AuxPartitionRealtimeStrategy } from './AuxPartition';
import type { PartitionConfig, MemoryPartitionStateConfig } from './AuxPartitionConfig';
import type { BotsState, BotAction, Bot, UpdatedBot, StateUpdatedEvent } from '../bots';
import type { Observable } from 'rxjs';
import type { TagEdit } from '../bots';
import type { Action, CurrentVersion, StatusUpdate } from '../common';
/**
* Attempts to create a MemoryPartition from the given config.
* @param config The config.
*/
export declare function createMemoryPartition(config: PartitionConfig): MemoryPartition;
export declare class MemoryPartitionImpl implements MemoryPartition {
private _onBotsAdded;
private _onBotsRemoved;
private _onBotsUpdated;
private _onStateUpdated;
private _onVersionUpdated;
private _onError;
private _onEvents;
private _onStatusUpdated;
private _siteId;
private _remoteSite;
private _updateCounter;
type: "memory";
state: BotsState;
private: boolean;
space: string;
/**
* A function that returns the version that should be used for state updates.
*/
getCurrentVersion: () => CurrentVersion;
get realtimeStrategy(): AuxPartitionRealtimeStrategy;
get onBotsAdded(): Observable<Bot[]>;
get onBotsRemoved(): Observable<string[]>;
get onBotsUpdated(): Observable<UpdatedBot[]>;
get onStateUpdated(): Observable<StateUpdatedEvent>;
get onVersionUpdated(): Observable<CurrentVersion>;
get onError(): Observable<any>;
get onEvents(): Observable<Action[]>;
get onStatusUpdated(): Observable<StatusUpdate>;
constructor(config: MemoryPartitionStateConfig);
applyEvents(events: BotAction[]): Promise<BotAction[]>;
connect(): void;
unsubscribe(): void;
closed: boolean;
private _applyEvents;
private _getCurrentVersion;
/**
* Gets the version that should be used for the resulting edit when the given text edit is applied.
*/
getNextVersion(textEdit: TagEdit): CurrentVersion;
}
//# sourceMappingURL=MemoryPartition.d.ts.map