import { StorageService } from './storage.service'; import { StorageTranscoder, StorageDecoder, StorageEncoder } from './storage-transcoder'; /** * A storage service implementation that is used as a proxy for another storage service. This is used to create storage services with a * different default transcoder. */ export declare class ProxyStorageService implements StorageService { private readonly defaultTranscoder; private readonly subject; /** * Creates a new `ProxyStorageService` instance that uses the specified transcoder by default for read and write operations. Actual * read and writes are delegated to given storage service. * * @param defaultTranscoder Transcoder which is to be used by default for storage read and write operations. * @param subject Storage service which should handle to actual storage of data. */ constructor(defaultTranscoder: StorageTranscoder, subject: StorageService); /** * Checks whether an entry with the specified key exists in the storage. * * @param key Identifier of the entry for which its presence in the storage is to be checked. * @returns `true` if an entry with the specified key exists in the storage, `false` if not. */ has(key: string): boolean; get(key: string, decoder?: StorageDecoder): any; /** * Creates or updates the entry identified by the specified key with the given value. The specified encoder is used to convert the given * value into a format that can be stored by the storage service's underlying storage. * * Storing a value into the storage service will ensure that an equivalent of the value can be read back, i.e. the data and structure of * the value will be the same. It, however, does not necessarily return the same reference. * * @param key Identifier of the entry which is to be created or updated. * @param value Value which is to be stored. * @param encoder Encoder used to convert the given value into a format that can be used for storage. */ set(key: string, value: any, encoder?: StorageEncoder): void; /** * Removes the entry that is identified by the specified key. Attempting to remove an entry for an unknown key will have no effect. * Attempting to retrieve an entry via the `get` method after it has been removed will result in `undefined`. * * @param key Identifier of the entry which is to be removed. */ remove(key: string): void; /** * Clears the storage by removing all entries. Subsequent `get(x)` calls for a key *x* will return `undefined`, until a new value is set * for key *x*. */ clear(): void; /** * Creates a new storage service that uses the specified transcoder by default for read and write operations. The new storage service * uses the storage service on which this function is invoked as underlying storage. Both storage services will thus be able to access * the same data. * * The default transcoder will not be changed for the storage service on which this function is invoked. * * @param transcoder Transcoder that should be used by default for read and write operations by the new storage service. * @returns A new storage service that uses the specified transcoder by default. */ withDefaultTranscoder(transcoder: StorageTranscoder): StorageService; }