@@ -3,9 +3,9 @@ import { log } from "../storage.ts";
33import { BaseStorageProvider , type StorageValue } from "./base.ts" ;
44
55/**
6- * In -memory storage provider. Just for testing.
6+ * Volatile (in -memory) storage provider. Just for testing.
77 *
8- * It doesn't make much sense, since it's just a copy of the in memory docs.
8+ * It doesn't make much sense, since it's just a copy of the volatile docs.
99 * But for testing we can create multiple instances that share the memory.
1010 */
1111const spaceStorageMap = new Map < string , Map < string , StorageValue > > ( ) ;
@@ -32,7 +32,7 @@ function getOrCreateSpaceSubscribers(
3232 return spaceSubscribersMap . get ( spaceName ) ! ;
3333}
3434
35- export class InMemoryStorageProvider extends BaseStorageProvider {
35+ export class VolatileStorageProvider extends BaseStorageProvider {
3636 private handleStorageUpdateFn : ( key : string , value : any ) => void ;
3737 private lastValues = new Map < string , string | undefined > ( ) ;
3838 private spaceName : string ;
@@ -62,7 +62,7 @@ export class InMemoryStorageProvider extends BaseStorageProvider {
6262 const key = JSON . stringify ( entityId ) ;
6363 const valueString = JSON . stringify ( value ) ;
6464 if ( this . lastValues . get ( key ) !== valueString ) {
65- log ( ( ) => [ "send in memory " , this . spaceName , key , valueString ] ) ;
65+ log ( ( ) => [ "send volatile " , this . spaceName , key , valueString ] ) ;
6666 this . lastValues . set ( key , valueString ) ;
6767 spaceStorage . set ( key , value ) ;
6868 spaceSubscribers . forEach ( ( listener ) => listener ( key , value ) ) ;
@@ -79,7 +79,7 @@ export class InMemoryStorageProvider extends BaseStorageProvider {
7979 const spaceStorage = getOrCreateSpaceStorage ( this . spaceName ) ;
8080 const key = JSON . stringify ( entityId ) ;
8181 log (
82- ( ) => [ "sync in memory " , this . spaceName , key , this . lastValues . get ( key ) ] ,
82+ ( ) => [ "sync volatile " , this . spaceName , key , this . lastValues . get ( key ) ] ,
8383 ) ;
8484 if ( spaceStorage . has ( key ) ) {
8585 this . lastValues . set ( key , JSON . stringify ( spaceStorage . get ( key ) ! ) ) ;
@@ -91,7 +91,7 @@ export class InMemoryStorageProvider extends BaseStorageProvider {
9191
9292 get < T > ( entityId : EntityId ) : StorageValue < T > | undefined {
9393 const key = JSON . stringify ( entityId ) ;
94- log ( ( ) => [ "get in memory " , this . spaceName , key , this . lastValues . get ( key ) ] ) ;
94+ log ( ( ) => [ "get volatile " , this . spaceName , key , this . lastValues . get ( key ) ] ) ;
9595 return this . lastValues . has ( key )
9696 ? ( JSON . parse ( this . lastValues . get ( key ) ! ) as StorageValue )
9797 : undefined ;
0 commit comments