Search in sources :

Example 1 with DirectMemoryProvider

use of org.apache.ignite.internal.mem.DirectMemoryProvider in project ignite by apache.

the class MetadataStorageSelfTest method memory.

/**
     * @param clean Clean flag. If {@code true}, will clean previous memory state and allocate
     *      new empty page memory.
     * @return Page memory instance.
     */
protected PageMemory memory(boolean clean) throws Exception {
    DirectMemoryProvider provider = new MappedFileMemoryProvider(log(), allocationPath);
    MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setMaxSize(30 * 1024 * 1024).setInitialSize(30 * 1024 * 1024);
    return new PageMemoryNoStoreImpl(log, provider, null, PAGE_SIZE, plcCfg, new MemoryMetricsImpl(plcCfg), true);
}
Also used : MappedFileMemoryProvider(org.apache.ignite.internal.mem.file.MappedFileMemoryProvider) PageMemoryNoStoreImpl(org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl) DirectMemoryProvider(org.apache.ignite.internal.mem.DirectMemoryProvider) MemoryPolicyConfiguration(org.apache.ignite.configuration.MemoryPolicyConfiguration) MemoryMetricsImpl(org.apache.ignite.internal.processors.cache.database.MemoryMetricsImpl)

Example 2 with DirectMemoryProvider

use of org.apache.ignite.internal.mem.DirectMemoryProvider in project ignite by apache.

the class PageMemoryNoLoadSelfTest method memory.

/**
     * @return Page memory implementation.
     * @throws Exception If failed.
     */
protected PageMemory memory() throws Exception {
    File memDir = U.resolveWorkDirectory(U.defaultWorkDirectory(), "pagemem", false);
    MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setMaxSize(MAX_MEMORY_SIZE).setInitialSize(MAX_MEMORY_SIZE);
    DirectMemoryProvider provider = new MappedFileMemoryProvider(log(), memDir);
    return new PageMemoryNoStoreImpl(log(), provider, null, PAGE_SIZE, plcCfg, new MemoryMetricsImpl(plcCfg), true);
}
Also used : MappedFileMemoryProvider(org.apache.ignite.internal.mem.file.MappedFileMemoryProvider) DirectMemoryProvider(org.apache.ignite.internal.mem.DirectMemoryProvider) MemoryPolicyConfiguration(org.apache.ignite.configuration.MemoryPolicyConfiguration) File(java.io.File) MemoryMetricsImpl(org.apache.ignite.internal.processors.cache.database.MemoryMetricsImpl)

Example 3 with DirectMemoryProvider

use of org.apache.ignite.internal.mem.DirectMemoryProvider in project ignite by apache.

the class IgniteCacheDatabaseSharedManager method initMemory.

/**
     * @param memCfg memory configuration with common parameters.
     * @param plcCfg memory policy with PageMemory specific parameters.
     * @param memMetrics {@link MemoryMetrics} object to collect memory usage metrics.
     * @return Memory policy instance.
     */
private MemoryPolicy initMemory(MemoryConfiguration memCfg, MemoryPolicyConfiguration plcCfg, MemoryMetricsImpl memMetrics) {
    File allocPath = buildAllocPath(plcCfg);
    DirectMemoryProvider memProvider = allocPath == null ? new UnsafeMemoryProvider(log) : new MappedFileMemoryProvider(log, allocPath);
    PageMemory pageMem = createPageMemory(memProvider, memCfg, plcCfg, memMetrics);
    return new MemoryPolicy(pageMem, plcCfg, memMetrics, createPageEvictionTracker(plcCfg, pageMem));
}
Also used : MappedFileMemoryProvider(org.apache.ignite.internal.mem.file.MappedFileMemoryProvider) DirectMemoryProvider(org.apache.ignite.internal.mem.DirectMemoryProvider) PageMemory(org.apache.ignite.internal.pagemem.PageMemory) File(java.io.File) UnsafeMemoryProvider(org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider)

Aggregations

DirectMemoryProvider (org.apache.ignite.internal.mem.DirectMemoryProvider)3 MappedFileMemoryProvider (org.apache.ignite.internal.mem.file.MappedFileMemoryProvider)3 File (java.io.File)2 MemoryPolicyConfiguration (org.apache.ignite.configuration.MemoryPolicyConfiguration)2 MemoryMetricsImpl (org.apache.ignite.internal.processors.cache.database.MemoryMetricsImpl)2 UnsafeMemoryProvider (org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider)1 PageMemory (org.apache.ignite.internal.pagemem.PageMemory)1 PageMemoryNoStoreImpl (org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl)1