org.apache.jackrabbit.oak.spi.state.NodeStore.checkpointInfo()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(68)

本文整理了Java中org.apache.jackrabbit.oak.spi.state.NodeStore.checkpointInfo()方法的一些代码示例,展示了NodeStore.checkpointInfo()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NodeStore.checkpointInfo()方法的具体详情如下:
包路径:org.apache.jackrabbit.oak.spi.state.NodeStore
类名称:NodeStore
方法名:checkpointInfo

NodeStore.checkpointInfo介绍

[英]Retrieve the properties associated with a checkpoint.
[中]检索与检查点关联的属性。

代码示例

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Nonnull
@Override
public Map<String, String> checkpointInfo(@Nonnull String checkpoint) {
  return getNodeStore().checkpointInfo(checkpoint);
}

代码示例来源:origin: apache/jackrabbit-oak

@NotNull
@Override
public Map<String, String> checkpointInfo(@NotNull String checkpoint) {
  return getNodeStore().checkpointInfo(checkpoint);
}

代码示例来源:origin: apache/jackrabbit-oak

@NotNull
@Override
public Map<String, String> checkpointInfo(@NotNull String checkpoint) {
  if (inheritedCheckpoints.contains(checkpoint)) {
    return nodeStore.checkpointInfo(checkpoint);
  } else if (checkpointMapping.containsKey(checkpoint)) {
    return memoryNodeStore.checkpointInfo(checkpointMapping.get(checkpoint));
  } else {
    return emptyMap();
  }
}

代码示例来源:origin: org.apache.jackrabbit/oak-core

@NotNull
@Override
public Map<String, String> checkpointInfo(@NotNull String checkpoint) {
  return getNodeStore().checkpointInfo(checkpoint);
}

代码示例来源:origin: org.apache.jackrabbit/oak-core

@NotNull
@Override
public Map<String, String> checkpointInfo(@NotNull String checkpoint) {
  if (inheritedCheckpoints.contains(checkpoint)) {
    return nodeStore.checkpointInfo(checkpoint);
  } else if (checkpointMapping.containsKey(checkpoint)) {
    return memoryNodeStore.checkpointInfo(checkpointMapping.get(checkpoint));
  } else {
    return emptyMap();
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@NotNull
@Override
public Map<String, String> checkpointInfo(@NotNull String checkpoint) {
  return getNodeStore().checkpointInfo(checkpoint);
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Nonnull
@Override
public Map<String, String> checkpointInfo(@Nonnull String checkpoint) {
  return getNodeStore().checkpointInfo(checkpoint);
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Nonnull
@Override
public Map<String, String> checkpointInfo(@Nonnull String checkpoint) {
  if (inheritedCheckpoints.contains(checkpoint)) {
    return nodeStore.checkpointInfo(checkpoint);
  } else if (checkpointMapping.containsKey(checkpoint)) {
    return memoryNodeStore.checkpointInfo(checkpointMapping.get(checkpoint));
  } else {
    return emptyMap();
  }
}

代码示例来源:origin: apache/jackrabbit-oak

public void dispose() {
  for (String cp : nodeStore.checkpoints()) {
    if ("copy-on-write".equals(nodeStore.checkpointInfo(cp).get("type"))) {
      nodeStore.release(cp);
    }
  }
}

代码示例来源:origin: org.apache.jackrabbit/oak-core

public void dispose() {
  for (String cp : nodeStore.checkpoints()) {
    if ("copy-on-write".equals(nodeStore.checkpointInfo(cp).get("type"))) {
      nodeStore.release(cp);
    }
  }
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

public void dispose() {
  for (String cp : nodeStore.checkpoints()) {
    if ("copy-on-write".equals(nodeStore.checkpointInfo(cp).get("type"))) {
      nodeStore.release(cp);
    }
  }
}

代码示例来源:origin: apache/jackrabbit-oak

private boolean isCompositeCheckpoint(String checkpoint) {
  Map<String, String> props = ctx.getGlobalStore().getNodeStore().checkpointInfo(checkpoint);
  if (props == null) {
    return false;
  }
  return props.containsKey(CHECKPOINT_METADATA + "created");
}

代码示例来源:origin: apache/jackrabbit-oak

Map<String, String> allCheckpointInfo(String checkpoint) {
  return ctx.getGlobalStore().getNodeStore().checkpointInfo(checkpoint);
}

代码示例来源:origin: apache/jackrabbit-oak

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;
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
public Map<String, String> checkpointInfo(String checkpoint) {
  if (!checkpointExists(ctx.getGlobalStore().getNodeStore(), checkpoint)) {
    LOG.warn("Checkpoint {} doesn't exist. Debug info:\n{}", checkpoint, checkpointDebugInfo());
    return Collections.emptyMap();
  }
  return copyOf(filterKeys(ctx.getGlobalStore().getNodeStore().checkpointInfo(checkpoint), new Predicate<String>() {
    @Override
    public boolean apply(String input) {
      return !input.startsWith(CHECKPOINT_METADATA);
    }
  }));
}

代码示例来源:origin: apache/jackrabbit-oak

@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;
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
public boolean release(String checkpoint) {
  Map<String, String> props;
  boolean result;
  if (checkpointExists(ctx.getGlobalStore().getNodeStore(), checkpoint)) {
    props = ctx.getGlobalStore().getNodeStore().checkpointInfo(checkpoint);
    result = ctx.getGlobalStore().getNodeStore().release(checkpoint);
  } else {
    props = Collections.emptyMap();
    result = true;
  }
  if (LOG.isDebugEnabled()) {
    LOG.debug("Released checkpoint {}. Result: {}. Debug info:\n{}", checkpoint, result, checkpointDebugInfo());
  }
  return result;
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void checkpointInfo() throws CommitFailedException {
  ImmutableMap<String, String> props = ImmutableMap.of(
      "one", "1", "two", "2", "three", "2");
  String cp = store.checkpoint(Long.MAX_VALUE, props);
  assertEquals(props, store.checkpointInfo(cp));
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
  public void checkpointsInCowMode() throws CommitFailedException {
    String checkpoint1 = cowNodeStore.checkpoint(Long.MAX_VALUE, of("k", "v"));
    cowNodeStore.enableCopyOnWrite();

    Map<String, String> info = cowNodeStore.checkpointInfo(checkpoint1);
    assertEquals("The checkpoint is not inherited", of("k", "v"), info);

    NodeState root = cowNodeStore.getRoot();
    NodeBuilder builder = root.builder();
    builder.child("foo");
    cowNodeStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);

    String checkpoint2 = cowNodeStore.checkpoint(Long.MAX_VALUE, of("k", "v2"));
    info = cowNodeStore.checkpointInfo(checkpoint2);
    assertEquals("The new checkpoint is not available", of("k", "v2"), info);
    assertTrue("The retrieve() doesn't work for the new checkpoint", cowNodeStore.retrieve(checkpoint2).hasChildNode("foo"));
    assertEquals(ImmutableList.of(checkpoint1, checkpoint2), cowNodeStore.checkpoints());

    assertTrue("The new checkpoint shouldn't be stored in the main store", store.checkpointInfo(checkpoint2).isEmpty());

    cowNodeStore.disableCopyOnWrite();
    assertTrue("The new checkpoint should be dropped after disabling the CoW mode", cowNodeStore.checkpointInfo(checkpoint2).isEmpty());
  }
}

代码示例来源:origin: apache/jackrabbit-oak

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));
  }
}

相关文章