mirror of
https://github.com/immich-app/immich.git
synced 2025-02-18 01:24:26 -05:00
27 lines
681 B
Dart
27 lines
681 B
Dart
import 'dart:async';
|
|
|
|
import 'package:immich_mobile/domain/models/store.model.dart';
|
|
|
|
abstract class IStoreConverter<T, U> {
|
|
const IStoreConverter();
|
|
|
|
/// Converts the value T to the primitive type U supported by the Store
|
|
U toPrimitive(T value);
|
|
|
|
/// Converts the value back to T? from the primitive type U from the Store
|
|
FutureOr<T?> fromPrimitive(U value);
|
|
}
|
|
|
|
abstract class IStoreRepository {
|
|
FutureOr<T?> tryGet<T, U>(StoreKey<T, U> key);
|
|
|
|
FutureOr<T> get<T, U>(StoreKey<T, U> key);
|
|
|
|
FutureOr<bool> set<T, U>(StoreKey<T, U> key, T value);
|
|
|
|
FutureOr<void> delete(StoreKey key);
|
|
|
|
Stream<T?> watch<T, U>(StoreKey<T, U> key);
|
|
|
|
FutureOr<void> clearStore();
|
|
}
|