at_persistence_secondary_server 3.1.0 copy "at_persistence_secondary_server: ^3.1.0" to clipboard
at_persistence_secondary_server: ^3.1.0 copied to clipboard

unlisted

A Dart library with the implementation classes for the persistence layer of the secondary server.

example/main.dart

import 'dart:async';

import 'package:at_persistence_secondary_server/at_persistence_secondary_server.dart';

Future<void> main(List<String> arguments) async {
  // keystore
  var keyStoreManager = SecondaryPersistenceStoreFactory.getInstance()
      .getSecondaryPersistenceStore('@alice')!;
  var keyStore = keyStoreManager.getSecondaryKeyStore()!;
  var atData = AtData();
  atData.data = '123';
  var result = await keyStore.create('phone', atData);
  print(result);

  //commitLog keystore
  var commitLogInstance = await (AtCommitLogManagerImpl.getInstance()
      .getCommitLog('@alice') as FutureOr<AtCommitLog>);
  var hiveKey =
      await commitLogInstance.commit('location@alice', CommitOp.UPDATE);
  var committedEntry = await commitLogInstance.getEntry(hiveKey);
  print(committedEntry);

  //Notification keystore
  var notificationKeyStore = AtNotificationKeystore.getInstance();
  var atNotification = (AtNotificationBuilder()
        ..id = '123'
        ..fromAtSign = '@alice'
        ..notificationDateTime = DateTime.now().toUtcMillisecondsPrecision()
        ..toAtSign = '@alice'
        ..notification = 'self_received_notification'
        ..type = NotificationType.received
        ..opType = OperationType.update)
      .build();
  await notificationKeyStore.put('@alice', atNotification);
  var notificationEntry = await notificationKeyStore.get('@alice');
  print(notificationEntry);
}
5
likes
0
points
9.04k
downloads

Publisher

verified publisheratsign.org

Weekly Downloads

A Dart library with the implementation classes for the persistence layer of the secondary server.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

at_commons, at_persistence_spec, at_utf7, at_utils, cron, crypto, hive, meta, path, uuid

More

Packages that depend on at_persistence_secondary_server