@Override public NodeState retrieve(@NotNull String checkpoint) { if (inheritedCheckpoints.contains(checkpoint)) { return nodeStore.retrieve(checkpoint); } else if (checkpointMapping.containsKey(checkpoint)) { return memoryNodeStore.retrieve(checkpointMapping.get(checkpoint)); } else { return null; } }
@Override public NodeState retrieve(@Nonnull String checkpoint) { if (inheritedCheckpoints.contains(checkpoint)) { return nodeStore.retrieve(checkpoint); } else if (checkpointMapping.containsKey(checkpoint)) { return memoryNodeStore.retrieve(checkpointMapping.get(checkpoint)); } else { return null; } }
@Override public NodeState retrieve(@NotNull String checkpoint) { if (inheritedCheckpoints.contains(checkpoint)) { return nodeStore.retrieve(checkpoint); } else if (checkpointMapping.containsKey(checkpoint)) { return memoryNodeStore.retrieve(checkpointMapping.get(checkpoint)); } else { return null; } }
@Override public NodeState retrieve(@NotNull String checkpoint) { return getNodeStore().retrieve(checkpoint); }
@Override public NodeState retrieve(@NotNull String checkpoint) { return getNodeStore().retrieve(checkpoint); }
@Override public NodeState retrieve(String checkpoint) { return getNodeStore().retrieve(checkpoint); }
@Override public NodeState retrieve(@Nonnull String checkpoint) { return getNodeStore().retrieve(checkpoint); }
@Override public NodeState retrieve(String checkpoint) { return getNodeStore().retrieve(checkpoint); }
public BranchNodeStore(NodeStore nodeStore) throws CommitFailedException { this.nodeStore = nodeStore; this.inheritedCheckpoints = newArrayList(nodeStore.checkpoints()); this.checkpointMapping = newConcurrentMap(); String cp = nodeStore.checkpoint(CHECKPOINT_LIFETIME, singletonMap("type", "copy-on-write")); memoryNodeStore = new MemoryNodeStore(nodeStore.retrieve(cp)); }
public BranchNodeStore(NodeStore nodeStore) throws CommitFailedException { this.nodeStore = nodeStore; this.inheritedCheckpoints = newArrayList(nodeStore.checkpoints()); this.checkpointMapping = newConcurrentMap(); String cp = nodeStore.checkpoint(CHECKPOINT_LIFETIME, singletonMap("type", "copy-on-write")); memoryNodeStore = new MemoryNodeStore(nodeStore.retrieve(cp)); }
public BranchNodeStore(NodeStore nodeStore) throws CommitFailedException { this.nodeStore = nodeStore; this.inheritedCheckpoints = newArrayList(nodeStore.checkpoints()); this.checkpointMapping = newConcurrentMap(); String cp = nodeStore.checkpoint(CHECKPOINT_LIFETIME, singletonMap("type", "copy-on-write")); memoryNodeStore = new MemoryNodeStore(nodeStore.retrieve(cp)); }
public IndexImporter(NodeStore nodeStore, File indexDir, IndexEditorProvider indexEditorProvider, AsyncIndexerLock indexerLock) throws IOException { checkArgument(indexDir.exists() && indexDir.isDirectory(), "Path [%s] does not point " + "to existing directory", indexDir.getAbsolutePath()); this.nodeStore = nodeStore; this.indexDir = indexDir; this.indexEditorProvider = indexEditorProvider; indexerInfo = IndexerInfo.fromDirectory(indexDir); this.indexerLock = indexerLock; indexes = indexerInfo.getIndexes(); indexedState = checkNotNull(nodeStore.retrieve(indexerInfo.checkpoint), "Cannot retrieve " + "checkpointed state [%s]", indexerInfo.checkpoint); this.indexDefinitionUpdater = new IndexDefinitionUpdater(new File(indexDir, INDEX_DEFINITIONS_JSON)); this.asyncLaneToIndexMapping = mapIndexesToLanes(indexes); }
public IndexImporter(NodeStore nodeStore, File indexDir, IndexEditorProvider indexEditorProvider, AsyncIndexerLock indexerLock) throws IOException { checkArgument(indexDir.exists() && indexDir.isDirectory(), "Path [%s] does not point " + "to existing directory", indexDir.getAbsolutePath()); this.nodeStore = nodeStore; this.indexDir = indexDir; this.indexEditorProvider = indexEditorProvider; indexerInfo = IndexerInfo.fromDirectory(indexDir); this.indexerLock = indexerLock; indexes = indexerInfo.getIndexes(); indexedState = checkNotNull(nodeStore.retrieve(indexerInfo.checkpoint), "Cannot retrieve " + "checkpointed state [%s]", indexerInfo.checkpoint); this.indexDefinitionUpdater = new IndexDefinitionUpdater(new File(indexDir, INDEX_DEFINITIONS_JSON)); this.asyncLaneToIndexMapping = mapIndexesToLanes(indexes); }
public IndexImporter(NodeStore nodeStore, File indexDir, IndexEditorProvider indexEditorProvider, AsyncIndexerLock indexerLock) throws IOException { checkArgument(indexDir.exists() && indexDir.isDirectory(), "Path [%s] does not point " + "to existing directory", indexDir.getAbsolutePath()); this.nodeStore = nodeStore; this.indexDir = indexDir; this.indexEditorProvider = indexEditorProvider; indexerInfo = IndexerInfo.fromDirectory(indexDir); this.indexerLock = indexerLock; indexes = indexerInfo.getIndexes(); indexedState = checkNotNull(nodeStore.retrieve(indexerInfo.checkpoint), "Cannot retrieve " + "checkpointed state [%s]", indexerInfo.checkpoint); this.indexDefinitionUpdater = new IndexDefinitionUpdater(new File(indexDir, INDEX_DEFINITIONS_JSON)); this.asyncLaneToIndexMapping = mapIndexesToLanes(indexes); }
@Test public void retrieveAny() { assertTrue(store.retrieve("r42-0-0") == null); }
@Override public NodeState retrieve(String checkpoint) { if (!checkpointExists(ctx.getGlobalStore().getNodeStore(), checkpoint)) { LOG.warn("Checkpoint {} doesn't exist on the global store. Debug info:\n{}", checkpoint, checkpointDebugInfo()); return null; } Map<String, String> props = ctx.getGlobalStore().getNodeStore().checkpointInfo(checkpoint); Map<MountedNodeStore, NodeState> nodeStates = newHashMap(); nodeStates.put(ctx.getGlobalStore(), ctx.getGlobalStore().getNodeStore().retrieve(checkpoint)); for (MountedNodeStore nodeStore : ctx.getNonDefaultStores()) { NodeState nodeState; String partialCheckpoint = getPartialCheckpointName(nodeStore, checkpoint, props, true); if (partialCheckpoint == null) { nodeState = nodeStore.getNodeStore().getRoot(); } else { nodeState = nodeStore.getNodeStore().retrieve(partialCheckpoint); } nodeStates.put(nodeStore, nodeState); } if (any(nodeStates.values(), isNull())) { LOG.warn("Checkpoint {} doesn't exist. Debug info:\n{}", checkpoint, checkpointDebugInfo()); return null; } return ctx.createRootNodeState(nodeStates); }
@After public void cleanup() throws Exception { assertTrue("Test method was not executed", executed.get()); String referenced = getReferenceCp(store, name); assertNotNull("Reference checkpoint doesn't exist", referenced); assertNotNull( "Failed indexer must not clean successful indexer's checkpoint", store.retrieve(referenced)); }
@Override public void importIndex(NodeState root, NodeBuilder defn, File indexDir) { assertEquals("fooIndex", indexDir.getName()); assertEquals(2, defn.getProperty(REINDEX_COUNT).getValue(Type.LONG).longValue()); defn.getChildNode(IndexConstants.INDEX_CONTENT_NODE_NAME).remove(); NodeState cpState = store.retrieve(checkpoint); NodeState indexData = NodeStateUtils.getNode(cpState, "/oak:index/fooIndex/:index"); defn.setChildNode(IndexConstants.INDEX_CONTENT_NODE_NAME, indexData); }
@Test public void checkpoint() throws CommitFailedException { String cp = store.checkpoint(Long.MAX_VALUE); NodeBuilder builder = store.getRoot().builder(); builder.setChildNode("new"); store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY); assertFalse(root.equals(store.getRoot())); assertEquals(root, store.retrieve(cp)); assertTrue(store.release(cp)); assertNull(store.retrieve(cp)); }
protected void verifyCheckpoint() { assertEquals("after", destination.getRoot().getString("checkpoint-state")); String checkpointReference = null; for (String c : destination.checkpoints()) { if (destination.checkpointInfo(c).containsKey("key")) { checkpointReference = c; break; } } assertNotNull(checkpointReference); Map<String, String> info = destination.checkpointInfo(checkpointReference); assertEquals("123", info.get("key")); NodeState checkpoint = destination.retrieve(checkpointReference); assertEquals("before", checkpoint.getString("checkpoint-state")); assertEquals("123", destination.getRoot().getChildNode(":async").getString("test")); for (String name : new String[] {"var", "etc", "sling.css", "apps", "libs", "sightly"}) { assertSameRecord(destination.getRoot().getChildNode(name), checkpoint.getChildNode(name)); } }