File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed
packages/sds/src/message_channel Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,11 @@ export interface ILocalHistory {
4848 ) : number ;
4949}
5050
51+ export interface MemLocalHistoryOptions {
52+ storage ?: ChannelId | PersistentStorage ;
53+ maxSize ?: number ;
54+ }
55+
5156export class MemLocalHistory implements ILocalHistory {
5257 private items : ContentMessage [ ] = [ ] ;
5358 private readonly storage ?: PersistentStorage ;
@@ -60,9 +65,7 @@ export class MemLocalHistory implements ILocalHistory {
6065 * - storage: Optional persistent storage backend for message persistence or channelId to use with PersistentStorage.
6166 * - maxSize: The maximum number of messages to store. Optional, defaults to DEFAULT_MAX_LENGTH.
6267 */
63- public constructor (
64- opts : { storage ?: ChannelId | PersistentStorage ; maxSize ?: number } = { }
65- ) {
68+ public constructor ( opts : MemLocalHistoryOptions = { } ) {
6669 const { storage, maxSize } = opts ;
6770 this . maxSize = maxSize ?? DEFAULT_MAX_LENGTH ;
6871 if ( storage instanceof PersistentStorage ) {
Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ import {
1515} from "./message.js" ;
1616import {
1717 DEFAULT_BLOOM_FILTER_OPTIONS ,
18- MessageChannel
18+ MessageChannel ,
19+ MessageChannelOptions
1920} from "./message_channel.js" ;
2021
2122const channelId = "test-channel" ;
@@ -30,12 +31,7 @@ const callback = (_message: Message): Promise<{ success: boolean }> => {
3031const createTestChannel = (
3132 channelId : string ,
3233 senderId : string ,
33- options : {
34- causalHistorySize ?: number ;
35- possibleAcksThreshold ?: number ;
36- timeoutForLostMessagesMs ?: number ;
37- enableRepair ?: boolean ;
38- } = { }
34+ options : MessageChannelOptions = { }
3935) : MessageChannel => {
4036 return new MessageChannel (
4137 channelId ,
You can’t perform that action at this time.
0 commit comments