congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
InMemoryStorageFactory
Code IndexAdd Tabnine to your IDE (free)

How to use
InMemoryStorageFactory
in
io.pravega.segmentstore.storage.mocks

Best Java code snippets using io.pravega.segmentstore.storage.mocks.InMemoryStorageFactory (Showing top 20 results out of 315)

origin: pravega/pravega

SingletonStorageFactory(ScheduledExecutorService executor) {
  this.storage = new InMemoryStorageFactory(executor).createStorageAdapter();
  this.storage.initialize(1);
  this.closed = new AtomicBoolean();
}
origin: pravega/pravega

@Override
protected Storage createStorage() {
  return InMemoryStorageFactory.newStorage(executorService());
}
origin: pravega/pravega

public InMemoryStorageFactory(ScheduledExecutorService executor) {
  this.executor = Preconditions.checkNotNull(executor, "executor");
  initialize();
}
origin: pravega/pravega

@Override
public StorageFactory createFactory(ConfigSetup setup, ScheduledExecutorService executor) {
  InMemoryStorageFactory factory = new InMemoryStorageFactory(executor);
  return factory;
}
origin: pravega/pravega

  @Override
  public void close() {
    this.container.close();
    this.storage.close();
    this.storageFactory.close();
  }
}
origin: pravega/pravega

@Before
public void setUp() {
  this.storageFactory = new InMemoryStorageFactory(executorService());
  this.durableDataLogFactory = new PermanentDurableDataLogFactory(executorService());
}
origin: pravega/pravega

@After
public void tearDown() {
  if (this.durableDataLogFactory != null) {
    this.durableDataLogFactory.close();
    this.durableDataLogFactory = null;
  }
  if (this.storageFactory != null) {
    this.storageFactory.close();
    this.storageFactory = null;
  }
}
origin: pravega/pravega

TestContext() {
  this.storageFactory = new InMemoryStorageFactory(executorService());
  this.container = new ReadOnlySegmentContainer(this.storageFactory, executorService());
  this.storage = this.storageFactory.createStorageAdapter();
}
origin: pravega/pravega

@Before
public void setUp() {
  this.storageFactory = new InMemoryStorageFactory(executorService());
  this.durableDataLogFactory = new PermanentDurableDataLogFactory(executorService());
}
origin: pravega/pravega

TestContext(ReadIndexConfig readIndexConfig, CachePolicy cachePolicy) {
  this.cacheFactory = new TestCacheFactory();
  this.metadata = new MetadataBuilder(CONTAINER_ID).build();
  this.storage = InMemoryStorageFactory.newStorage(executorService());
  this.storage.initialize(1);
  this.cacheManager = new TestCacheManager(cachePolicy, executorService());
  this.readIndex = new ContainerReadIndex(readIndexConfig, this.metadata, this.cacheFactory, this.storage, this.cacheManager, executorService());
}
origin: pravega/pravega

@After
public void tearDown() {
  if (this.durableDataLogFactory != null) {
    this.durableDataLogFactory.close();
    this.durableDataLogFactory = null;
  }
  if (this.storageFactory != null) {
    this.storageFactory.close();
    this.storageFactory = null;
  }
}
origin: pravega/pravega

  private Storage createStorage() {
    val factory = new InMemoryStorageFactory(executorService());
    return factory.createStorageAdapter();
  }
}
origin: pravega/pravega

/**
 * Creates a new instance of the ServiceBuilder class which is contained in memory. Any data added to this service will
 * be lost when the object is garbage collected or the process terminates.
 *
 * @param builderConfig   The ServiceBuilderConfig to use.
 * @param executorBuilder A Function that, given a thread count and a pool name, creates a ScheduledExecutorService
 *                        with the given number of threads that have the given name as prefix.
 */
@VisibleForTesting
public static ServiceBuilder newInMemoryBuilder(ServiceBuilderConfig builderConfig, ExecutorBuilder executorBuilder) {
  ServiceConfig serviceConfig = builderConfig.getConfig(ServiceConfig::builder);
  ServiceBuilder builder;
  if (serviceConfig.isReadOnlySegmentStore()) {
    // Only components required for ReadOnly SegmentStore.
    builder = new ReadOnlyServiceBuilder(builderConfig, serviceConfig, executorBuilder);
  } else {
    // Components that are required for general SegmentStore.
    builder = new ServiceBuilder(builderConfig, serviceConfig, executorBuilder)
        .withCacheFactory(setup -> new InMemoryCacheFactory());
  }
  // Components that are required for all types of SegmentStore.
  return builder
      .withDataLogFactory(setup -> new InMemoryDurableDataLogFactory(setup.getCoreExecutor()))
      .withContainerManager(setup -> new LocalSegmentContainerManager(
          setup.getContainerRegistry(), setup.getSegmentToContainerMapper()))
      .withStorageFactory(setup -> new InMemoryStorageFactory(setup.getStorageExecutor()))
      .withStreamSegmentStore(setup -> new StreamSegmentService(setup.getContainerRegistry(),
          setup.getSegmentToContainerMapper()));
}
origin: pravega/pravega

ContainerSetup(ScheduledExecutorService executorService) {
  this.dataLog = new AtomicReference<>();
  this.executorService = executorService;
  this.dataLogFactory = new TestDurableDataLogFactory(new InMemoryDurableDataLogFactory(MAX_DATA_LOG_APPEND_SIZE, this.executorService), this.dataLog::set);
  this.metadata = new MetadataBuilder(CONTAINER_ID).build();
  this.cacheFactory = new InMemoryCacheFactory();
  this.storage = InMemoryStorageFactory.newStorage(executorService);
  this.storage.initialize(1);
  this.cacheManager = new CacheManager(CachePolicy.INFINITE, this.executorService);
  this.readIndex = new ContainerReadIndex(DEFAULT_READ_INDEX_CONFIG, metadata, this.cacheFactory, this.storage, this.cacheManager, this.executorService);
}
origin: pravega/pravega

/**
 * Creates a new instance of the DebugRecoveryProcessor class with the given arguments.
 *
 * @param containerId     The Id of the Container to recover.
 * @param durableDataLog  A DurableDataLog to recover from.
 * @param config          A ContainerConfig to use during recovery.
 * @param readIndexConfig A ReadIndexConfig to use during recovery.
 * @param executor        An Executor to use for background tasks.
 * @param callbacks       Callbacks to invoke during recovery.
 * @return A new instance of the DebugRecoveryProcessor.
 */
public static DebugRecoveryProcessor create(int containerId, DurableDataLog durableDataLog, ContainerConfig config, ReadIndexConfig readIndexConfig,
                      ScheduledExecutorService executor, OperationCallbacks callbacks) {
  Preconditions.checkNotNull(durableDataLog, "durableDataLog");
  Preconditions.checkNotNull(config, "config");
  Preconditions.checkNotNull(readIndexConfig, "readIndexConfig");
  Preconditions.checkNotNull(executor, "executor");
  Preconditions.checkNotNull(callbacks, callbacks);
  StreamSegmentContainerMetadata metadata = new StreamSegmentContainerMetadata(containerId, config.getMaxActiveSegmentCount());
  CacheManager cacheManager = new CacheManager(new CachePolicy(Long.MAX_VALUE, Duration.ofHours(10), Duration.ofHours(1)), executor);
  cacheManager.startAsync().awaitRunning();
  ContainerReadIndexFactory rf = new ContainerReadIndexFactory(readIndexConfig, new NoOpCacheFactory(), cacheManager, executor);
  Storage s = new InMemoryStorageFactory(executor).createStorageAdapter();
  return new DebugRecoveryProcessor(metadata, durableDataLog, rf, s, cacheManager, callbacks);
}
origin: pravega/pravega

Storage storage = InMemoryStorageFactory.newStorage(executorService());
storage.initialize(1);
byte[] segmentData = populateSegment(storage);
origin: pravega/pravega

TestDurableDataLogFactory dataLogFactory = new TestDurableDataLogFactory(new InMemoryDurableDataLogFactory(MAX_DATA_LOG_APPEND_SIZE, executorService()), dataLog::set);
@Cleanup
Storage storage = InMemoryStorageFactory.newStorage(executorService());
storage.initialize(1);
UpdateableContainerMetadata metadata = new MetadataBuilder(CONTAINER_ID).build();
origin: pravega/pravega

TestDurableDataLogFactory dataLogFactory = new TestDurableDataLogFactory(new InMemoryDurableDataLogFactory(MAX_DATA_LOG_APPEND_SIZE, executorService()), dataLog::set);
@Cleanup
Storage storage = InMemoryStorageFactory.newStorage(executorService());
storage.initialize(1);
UpdateableContainerMetadata metadata = new MetadataBuilder(CONTAINER_ID).build();
origin: pravega/pravega

TestContext() {
  this.cacheFactory = new InMemoryCacheFactory();
  this.storage = InMemoryStorageFactory.newStorage(executorService());
  this.storage.initialize(1);
  this.metadata = new MetadataBuilder(CONTAINER_ID).build();
  ReadIndexConfig readIndexConfig = ReadIndexConfig.builder().with(ReadIndexConfig.STORAGE_READ_ALIGNMENT, 1024).build();
  this.cacheManager = new CacheManager(CachePolicy.INFINITE, executorService());
  this.readIndex = new ContainerReadIndex(readIndexConfig, this.metadata, this.cacheFactory, this.storage, this.cacheManager, executorService());
  this.memoryLog = new SequencedItemList<>();
  this.stateUpdater = new MemoryStateUpdater(this.memoryLog, this.readIndex, Runnables.doNothing());
}
origin: pravega/pravega

public void testInvalidRequests() {
  @Cleanup
  Storage storage = InMemoryStorageFactory.newStorage(executorService());
  storage.initialize(1);
  byte[] segmentData = populateSegment(storage);
io.pravega.segmentstore.storage.mocksInMemoryStorageFactory

Javadoc

In-Memory mock for StorageFactory. Contents is destroyed when object is garbage collected.

Most used methods

  • <init>
  • createStorageAdapter
  • newStorage
    Creates a new InMemory Storage, without a rolling wrapper.
  • close
  • initialize

Popular in Java

  • Start an intent from android
  • getResourceAsStream (ClassLoader)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now