private static boolean checkpointExists(NodeStore nodeStore, String checkpoint) { return Iterables.any(nodeStore.checkpoints(), Predicates.equalTo(checkpoint)); }
@NotNull @Override public Iterable<String> checkpoints() { return getNodeStore().checkpoints(); }
@NotNull @Override public Iterable<String> checkpoints() { List<String> result = newArrayList(inheritedCheckpoints); result.retainAll(newArrayList(nodeStore.checkpoints())); checkpointMapping.entrySet().stream() .filter(e -> memoryNodeStore.listCheckpoints().contains(e.getValue())) .map(Map.Entry::getKey) .forEach(result::add); return result; }
@NotNull @Override public Iterable<String> checkpoints() { return getNodeStore().checkpoints(); }
@NotNull @Override public Iterable<String> checkpoints() { return getNodeStore().checkpoints(); }
@NotNull @Override public Iterable<String> checkpoints() { List<String> result = newArrayList(inheritedCheckpoints); result.retainAll(newArrayList(nodeStore.checkpoints())); checkpointMapping.entrySet().stream() .filter(e -> memoryNodeStore.listCheckpoints().contains(e.getValue())) .map(Map.Entry::getKey) .forEach(result::add); return result; }
@Nonnull @Override public Iterable<String> checkpoints() { return getNodeStore().checkpoints(); }
@Nonnull @Override public Iterable<String> checkpoints() { List<String> result = newArrayList(inheritedCheckpoints); result.retainAll(newArrayList(nodeStore.checkpoints())); checkpointMapping.entrySet().stream() .filter(e -> memoryNodeStore.listCheckpoints().contains(e.getValue())) .map(Map.Entry::getKey) .forEach(result::add); return result; }
@Nonnull @Override public Iterable<String> checkpoints() { return getNodeStore().checkpoints(); }
public void dispose() { for (String cp : nodeStore.checkpoints()) { if ("copy-on-write".equals(nodeStore.checkpointInfo(cp).get("type"))) { nodeStore.release(cp); } } }
public void dispose() { for (String cp : nodeStore.checkpoints()) { if ("copy-on-write".equals(nodeStore.checkpointInfo(cp).get("type"))) { nodeStore.release(cp); } } }
public Iterable<String> checkpoints() { final NodeStore globalNodeStore = ctx.getGlobalStore().getNodeStore(); return filter(globalNodeStore.checkpoints(), new Predicate<String>() { @Override public boolean apply(String checkpoint) { return isCompositeCheckpoint(checkpoint); } }); }
public void dispose() { for (String cp : nodeStore.checkpoints()) { if ("copy-on-write".equals(nodeStore.checkpointInfo(cp).get("type"))) { nodeStore.release(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 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)); }
private String getPartialCheckpointName(MountedNodeStore nodeStore, String globalCheckpoint, Map<String, String> globalCheckpointProperties, boolean resolveByName) { Set<String> validCheckpointNames = ImmutableSet.copyOf(nodeStore.getNodeStore().checkpoints()); String result = globalCheckpointProperties.get(CHECKPOINT_METADATA_MOUNT + nodeStore.getMount().getName()); if (result != null && validCheckpointNames.contains(result)) { return result; } if (globalCheckpoint != null && validCheckpointNames.contains(globalCheckpoint)) { return globalCheckpoint; } if (resolveByName) { String nameProp = globalCheckpointProperties.get("name"); if (nameProp == null) { return null; } for (String c : validCheckpointNames) { Map<String, String> partialCheckpointProperties = nodeStore.getNodeStore().checkpointInfo(c); if (nameProp.equals(partialCheckpointProperties.get("name"))) { return c; } } } return null; }
@Override public long getOldestCheckpointCreationTimestamp() { Iterable<String> checkpoints = nodeStore.checkpoints(); long minCreationDate = Long.MAX_VALUE; for (String checkpoint : checkpoints) { Map<String, String> chkInfo = nodeStore.checkpointInfo(checkpoint); if (chkInfo.containsKey(CREATION_DATE) && Long.valueOf(chkInfo.get(CREATION_DATE)) < minCreationDate) { minCreationDate = Long.valueOf(chkInfo.get(CREATION_DATE)); } } if (minCreationDate == Long.MAX_VALUE) { minCreationDate = 0; } return minCreationDate; }
@Test public void testAsyncPropertyNoChanges() throws Exception { NodeStore store = new MemoryNodeStore(); assertTrue(Iterables.isEmpty(store.checkpoints())); AsyncIndexUpdate async = new AsyncIndexUpdate(ASYNC_REINDEX_VALUE, store, provider, true); async.run(); async.run(); async.close(); assertTrue(Iterables.isEmpty(store.checkpoints())); } }
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)); } }