public SnapshotsMetadataCleanupTask(Namespace namespace) { tables = TodoSchemaTableFactory.of(namespace); }
public SnapshotsIndexCleanupTask(Namespace namespace) { tables = TodoSchemaTableFactory.of(namespace); }
public static TodoSchemaTableFactory of() { return of(ImmutableList.<Function<? super Transaction, SharedTriggers>>of(), defaultNamespace); }
public static TodoSchemaTableFactory of(Namespace namespace) { return of(ImmutableList.<Function<? super Transaction, SharedTriggers>>of(), namespace); }
public SweepResults sweepSnapshotIndices() { TodoSchemaTableFactory tableFactory = TodoSchemaTableFactory.of(Namespace.DEFAULT_NAMESPACE); TableReference indexTable = tableFactory.getSnapshotsStreamIdxTable(null).getTableRef(); return sweepTable(indexTable); }
public boolean doesNotExistBeforeTimestamp(long id, long ts) { TableReference tableRef = TodoSchemaTableFactory.of().getTodoTable(null).getTableRef(); Cell cell = Cell.create(ValueType.FIXED_LONG.convertFromJava(id), TodoSchema.todoTextColumn()); return kvs.get().get(tableRef, ImmutableMap.of(cell, ts + 1)).isEmpty(); }
public SweepResults sweepSnapshotValues() { TodoSchemaTableFactory tableFactory = TodoSchemaTableFactory.of(Namespace.DEFAULT_NAMESPACE); TableReference valueTable = tableFactory.getSnapshotsStreamValueTable(null).getTableRef(); return sweepTable(valueTable); }
public void storeSnapshot(InputStream snapshot) { byte[] streamReference = "EteTest".getBytes(); TodoSchemaTableFactory tableFactory = TodoSchemaTableFactory.of(Namespace.DEFAULT_NAMESPACE); SnapshotsStreamStore streamStore = SnapshotsStreamStore.of(transactionManager, tableFactory); log.info("Storing stream..."); Pair<Long, Sha256Hash> storedStream = streamStore.storeStream(snapshot); Long newStreamId = storedStream.getLhSide(); log.info("Stored stream with ID {}", newStreamId); transactionManager.runTaskWithRetry(transaction -> { // Load previous stream, and unmark it as used LatestSnapshotTable.LatestSnapshotRow row = LatestSnapshotTable.LatestSnapshotRow.of(0L); LatestSnapshotTable latestSnapshotTable = tableFactory.getLatestSnapshotTable(transaction); Optional<LatestSnapshotTable.LatestSnapshotRowResult> maybeRow = latestSnapshotTable.getRow(row); maybeRow.ifPresent(latestSnapshot -> { Long latestStreamId = maybeRow.get().getStreamId(); log.info("Marking stream {}, ref {}, as unused", latestStreamId, PtBytes.toString(streamReference)); Map<Long, byte[]> theMap = ImmutableMap.of(latestStreamId, streamReference); streamStore.unmarkStreamsAsUsed(transaction, theMap); }); streamStore.markStreamAsUsed(transaction, newStreamId, streamReference); log.info("Marked stream {} as used with reference {}", newStreamId, PtBytes.toString(streamReference)); // Record the latest snapshot latestSnapshotTable.putStreamId(row, newStreamId); return null; }); }
public long addNamespacedTodoWithIdAndReturnTimestamp(long id, String namespace, Todo todo) { return transactionManager.runTaskWithRetry(tx -> { TodoSchemaTableFactory.of().getNamespacedTodoTable(tx).put( NamespacedTodoTable.NamespacedTodoRow.of(namespace), NamespacedTodoTable.NamespacedTodoColumnValue.of( NamespacedTodoTable.NamespacedTodoColumn.of(id), todo.text())); return tx.getTimestamp(); }); }
public SnapshotsIndexCleanupTask(Namespace namespace) { tables = TodoSchemaTableFactory.of(namespace); }
public SnapshotsMetadataCleanupTask(Namespace namespace) { tables = TodoSchemaTableFactory.of(namespace); }
public static TodoSchemaTableFactory of(Namespace namespace) { return of(ImmutableList.<Function<? super Transaction, SharedTriggers>>of(), namespace); }
public static TodoSchemaTableFactory of() { return of(ImmutableList.<Function<? super Transaction, SharedTriggers>>of(), defaultNamespace); }