本文整理汇总了Java中org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore类的典型用法代码示例。如果您正苦于以下问题:Java SegmentNodeStore类的具体用法?Java SegmentNodeStore怎么用?Java SegmentNodeStore使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SegmentNodeStore类属于org.apache.jackrabbit.oak.plugins.segment包,在下文中一共展示了SegmentNodeStore类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBackup
import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore; //导入依赖的package包/类
@Test
public void testBackup() throws Exception {
FileStore source = new FileStore(src, 8, false);
NodeStore store = new SegmentNodeStore(source);
init(store);
// initial content
FileStoreBackup.backup(store, destination);
compare(store, destination);
addTestContent(store);
FileStoreBackup.backup(store, destination);
compare(store, destination);
source.close();
}
示例2: testInitializerSegment
import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore; //导入依赖的package包/类
@Test
public void testInitializerSegment() throws CommitFailedException {
NodeStore store = new SegmentNodeStore(new MemoryStore());
NodeBuilder builder = store.getRoot().builder();
new InitialContent().initialize(builder);
SecurityProviderImpl provider = new SecurityProviderImpl(
ConfigurationParameters.of(ImmutableMap.of(UserConfiguration.NAME,
ConfigurationParameters.of(ImmutableMap.of("anonymousId", "anonymous",
"adminId", "admin",
"usersPath", "/home/users",
"groupsPath", "/home/groups",
"defaultDepth", "1")))));
provider.getConfiguration(UserConfiguration.class).getWorkspaceInitializer().initialize(
builder, "default");
builder.getNodeState();
}
示例3: getContentRepository
import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore; //导入依赖的package包/类
@Override
public ContentRepository getContentRepository() throws IOException {
mongo = new MongoClient(config.getHost(), config.getPort());
DB db = mongo.getDB(config.getDBName());
if (config.getUserId() != null && !config.getUserId().isEmpty()) {
boolean auth = db.authenticate(config.getUserId(), config
.getPassword().toCharArray());
if (!auth)
throw new RuntimeException("Invalid username/password");
}
store = new MongoStore(db, config.getCacheSize());
Oak oak = setupOak(new Oak(new SegmentNodeStore(store)));
return oak.createContentRepository();
}
示例4: compact
import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore; //导入依赖的package包/类
public void compact() {
long start = System.nanoTime();
log.info("TarMK compaction running");
SegmentWriter writer = new SegmentWriter(this, tracker);
Compactor compactor = new Compactor(writer);
SegmentNodeState before = getHead();
long existing = before.getChildNode(SegmentNodeStore.CHECKPOINTS)
.getChildNodeCount(Long.MAX_VALUE);
if (existing > 1) {
log.warn(
"TarMK compaction found {} checkpoints, you might need to run checkpoint cleanup",
existing);
}
SegmentNodeState after = compactor.compact(EMPTY_NODE, before);
writer.flush();
while (!setHead(before, after)) {
// Some other concurrent changes have been made.
// Rebase (and compact) those changes on top of the
// compacted state before retrying to set the head.
SegmentNodeState head = getHead();
after = compactor.compact(before, head);
before = head;
writer.flush();
}
tracker.setCompactionMap(compactor.getCompactionMap());
// Drop the SegmentWriter caches and flush any existing state
// in an attempt to prevent new references to old pre-compacted
// content. TODO: There should be a cleaner way to do this.
tracker.getWriter().dropCache();
tracker.getWriter().flush();
log.info("TarMK compaction completed in {}ms", MILLISECONDS
.convert(System.nanoTime() - start, NANOSECONDS));
}
示例5: TarConsole
import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore; //导入依赖的package包/类
public TarConsole(String repoPath){
super();
try {
fileStore = new FileStore(new File(repoPath), 256, false);
store = new SegmentNodeStore(fileStore);
root = store.getRoot();
} catch (IOException e) {
throw new RuntimeException("Error while opening the Tar repository",e);
}
}
示例6: createNodeStore
import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore; //导入依赖的package包/类
@Override
public NodeStore createNodeStore() {
return new SegmentNodeStore(new MemoryStore());
}
示例7: testRestore
import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore; //导入依赖的package包/类
@Test
public void testRestore() throws Exception {
FileStore source = new FileStore(src, 8, false);
NodeStore store = new SegmentNodeStore(source);
init(store);
// initial content
FileStoreBackup.backup(store, destination);
addTestContent(store);
FileStoreRestore.restore(destination, store);
compare(store, destination);
source.close();
}
示例8: compare
import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore; //导入依赖的package包/类
private static void compare(NodeStore store, File destination)
throws IOException {
FileStore backup = new FileStore(destination, 8, false);
assertEquals(store.getRoot(), new SegmentNodeStore(backup).getRoot());
backup.close();
}
示例9: getContentRepository
import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore; //导入依赖的package包/类
@Override
public ContentRepository getContentRepository() throws IOException {
store = new FileStore(new File(new File(config.getBaseDirectory()),"TarFileStore"), config.getMaxFileSize(), config.getMemoryMapping());
Oak oak = setupOak(new Oak(new SegmentNodeStore(store)));
return oak.createContentRepository();
}