Codota Logo
StateSnapshotController
Code IndexAdd Codota to your IDE (free)

How to use
StateSnapshotController
in
io.zeebe.logstreams.state

Best Java code snippets using io.zeebe.logstreams.state.StateSnapshotController (Showing top 10 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Gson g =
  • Codota Iconnew Gson()
  • Codota IconGsonBuilder gsonBuilder;gsonBuilder.create()
  • Codota Iconnew GsonBuilder().create()
  • Smart code suggestions by Codota
}
origin: zeebe-io/zeebe

@Override
public StateSnapshotMetadata recover(
  long commitPosition, int term, Predicate<StateSnapshotMetadata> filter) throws Exception {
 final File runtimeDirectory = storage.getRuntimeDirectory();
 final List<StateSnapshotMetadata> snapshots = storage.listRecoverable(commitPosition);
 StateSnapshotMetadata recoveredMetadata = null;
 if (!snapshots.isEmpty()) {
  recoveredMetadata =
    snapshots.stream()
      .sorted(Comparator.reverseOrder())
      .filter(filter)
      .findFirst()
      .orElse(null);
 }
 if (runtimeDirectory.exists()) {
  FileUtil.deleteFolder(runtimeDirectory.getAbsolutePath());
 }
 if (recoveredMetadata != null) {
  final File snapshotPath = storage.getSnapshotDirectoryFor(recoveredMetadata);
  copySnapshot(runtimeDirectory, snapshotPath);
 } else {
  recoveredMetadata = StateSnapshotMetadata.createInitial(term);
 }
 return recoveredMetadata;
}
origin: zeebe-io/zeebe

@Override
public void takeSnapshot(final StateSnapshotMetadata metadata) {
 if (db == null) {
  throw new IllegalStateException("Cannot create snapshot of not open database.");
 }
 if (exists(metadata)) {
  return;
 }
 final File snapshotDir = storage.getSnapshotDirectoryFor(metadata);
 db.createSnapshot(snapshotDir);
}
origin: zeebe-io/zeebe

private void startExporter(ServiceName<Partition> partitionName, Partition partition) {
 final StateStorage stateStorage =
   partition.getStateStorageFactory().create(EXPORTER_PROCESSOR_ID, PROCESSOR_NAME);
 final SnapshotController snapshotController =
   new StateSnapshotController(
     DefaultZeebeDbFactory.defaultFactory(ExporterColumnFamilies.class), stateStorage);
 streamProcessorServiceFactory
   .createService(partition, partitionName)
   .processorId(EXPORTER_PROCESSOR_ID)
   .processorName(PROCESSOR_NAME)
   .snapshotController(snapshotController)
   .streamProcessorFactory(
     (zeebeDb) ->
       new ExporterStreamProcessor(
         zeebeDb,
         partition.getInfo().getPartitionId(),
         exporterRepository.getExporters().values()))
   .build();
}
origin: io.zeebe/zeebe-broker-core

private void startExporter(ServiceName<Partition> partitionName, Partition partition) {
 final StateStorage stateStorage =
   partition.getStateStorageFactory().create(EXPORTER_PROCESSOR_ID, PROCESSOR_NAME);
 final SnapshotController snapshotController =
   new StateSnapshotController(
     DefaultZeebeDbFactory.defaultFactory(ExporterColumnFamilies.class), stateStorage);
 streamProcessorServiceFactory
   .createService(partition, partitionName)
   .processorId(EXPORTER_PROCESSOR_ID)
   .processorName(PROCESSOR_NAME)
   .snapshotController(snapshotController)
   .streamProcessorFactory(
     (zeebeDb) ->
       new ExporterStreamProcessor(
         zeebeDb,
         partition.getInfo().getPartitionId(),
         exporterRepository.getExporters().values()))
   .build();
}
origin: zeebe-io/zeebe

public void startStreamProcessors(
  final ServiceName<Partition> partitionServiceName, final Partition partition) {
 final int partitionId = partition.getInfo().getPartitionId();
 final Builder streamProcessorServiceBuilder =
   streamProcessorServiceFactory
     .createService(partition, partitionServiceName)
     .processorId(partitionId)
     .processorName(PROCESSOR_NAME);
 final StateStorage stateStorage =
   partition.getStateStorageFactory().create(partitionId, PROCESSOR_NAME);
 final StateSnapshotController stateSnapshotController =
   new StateSnapshotController(DefaultZeebeDbFactory.DEFAULT_DB_FACTORY, stateStorage);
 streamProcessorServiceBuilder
   .snapshotController(stateSnapshotController)
   .streamProcessorFactory(
     (zeebeDb) -> {
      final ZeebeState zeebeState = new ZeebeState(partitionId, zeebeDb);
      final TypedStreamEnvironment streamEnvironment =
        new TypedStreamEnvironment(
          partition.getLogStream(), clientApiTransport.getOutput());
      return createTypedStreamProcessor(
        partitionServiceName, partitionId, streamEnvironment, zeebeState);
     })
   .build();
}
origin: io.zeebe/zb-logstreams

@Override
public void takeSnapshot(final StateSnapshotMetadata metadata) {
 if (db == null) {
  throw new IllegalStateException("Cannot create snapshot of not open database.");
 }
 if (exists(metadata)) {
  return;
 }
 final File snapshotDir = storage.getSnapshotDirectoryFor(metadata);
 db.createSnapshot(snapshotDir);
}
origin: io.zeebe/zb-logstreams

@Override
public StateSnapshotMetadata recover(
  long commitPosition, int term, Predicate<StateSnapshotMetadata> filter) throws Exception {
 final File runtimeDirectory = storage.getRuntimeDirectory();
 final List<StateSnapshotMetadata> snapshots = storage.listRecoverable(commitPosition);
 StateSnapshotMetadata recoveredMetadata = null;
 if (!snapshots.isEmpty()) {
  recoveredMetadata =
    snapshots.stream()
      .sorted(Comparator.reverseOrder())
      .filter(filter)
      .findFirst()
      .orElse(null);
 }
 if (runtimeDirectory.exists()) {
  FileUtil.deleteFolder(runtimeDirectory.getAbsolutePath());
 }
 if (recoveredMetadata != null) {
  final File snapshotPath = storage.getSnapshotDirectoryFor(recoveredMetadata);
  copySnapshot(runtimeDirectory, snapshotPath);
 } else {
  recoveredMetadata = StateSnapshotMetadata.createInitial(term);
 }
 return recoveredMetadata;
}
origin: io.zeebe/zeebe-broker-core

public void startStreamProcessors(
  final ServiceName<Partition> partitionServiceName, final Partition partition) {
 final int partitionId = partition.getInfo().getPartitionId();
 final Builder streamProcessorServiceBuilder =
   streamProcessorServiceFactory
     .createService(partition, partitionServiceName)
     .processorId(partitionId)
     .processorName(PROCESSOR_NAME);
 final StateStorage stateStorage =
   partition.getStateStorageFactory().create(partitionId, PROCESSOR_NAME);
 final StateSnapshotController stateSnapshotController =
   new StateSnapshotController(DefaultZeebeDbFactory.DEFAULT_DB_FACTORY, stateStorage);
 streamProcessorServiceBuilder
   .snapshotController(stateSnapshotController)
   .streamProcessorFactory(
     (zeebeDb) -> {
      final ZeebeState zeebeState = new ZeebeState(partitionId, zeebeDb);
      final TypedStreamEnvironment streamEnvironment =
        new TypedStreamEnvironment(
          partition.getLogStream(), clientApiTransport.getOutput());
      return createTypedStreamProcessor(
        partitionServiceName, partitionId, streamEnvironment, zeebeState);
     })
   .build();
}
origin: zeebe-io/zeebe

 private StreamProcessorService buildStreamProcessorController() {
  final String name = "processor";
  final StateStorage stateStorage = getStateStorageFactory().create(streamProcessorId, name);
  currentSnapshotController = new StateSnapshotController(zeebeDbFactory, stateStorage);
  return LogStreams.createStreamProcessor(name, streamProcessorId)
    .logStream(stream)
    .snapshotController(currentSnapshotController)
    .actorScheduler(actorScheduler)
    .serviceContainer(serviceContainer)
    .streamProcessorFactory(
      zeebeDb -> {
       currentStreamProcessor.wrap(factory.createProcessor(zeebeDb));
       return currentStreamProcessor;
      })
    .build()
    .join();
 }
}
origin: io.zeebe/zeebe-broker-core

 private StreamProcessorService buildStreamProcessorController() {
  final String name = "processor";
  final StateStorage stateStorage = getStateStorageFactory().create(streamProcessorId, name);
  currentSnapshotController = new StateSnapshotController(zeebeDbFactory, stateStorage);
  return LogStreams.createStreamProcessor(name, streamProcessorId)
    .logStream(stream)
    .snapshotController(currentSnapshotController)
    .actorScheduler(actorScheduler)
    .serviceContainer(serviceContainer)
    .streamProcessorFactory(
      zeebeDb -> {
       currentStreamProcessor.wrap(factory.createProcessor(zeebeDb));
       return currentStreamProcessor;
      })
    .build()
    .join();
 }
}
io.zeebe.logstreams.stateStateSnapshotController

Javadoc

Controls how snapshot/recovery operations are performed

Most used methods

  • <init>
  • copySnapshot
  • exists

Popular in Java

  • Reactive rest calls using spring rest template
  • onRequestPermissionsResult (Fragment)
  • getExternalFilesDir (Context)
  • getSharedPreferences (Context)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • KeyStore (java.security)
    This class represents an in-memory collection of keys and certificates. It manages two types of entr
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • ImageIO (javax.imageio)
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now