Skip to content

Commit

Permalink
Ensure resource commits are properly unwrapped by resource manager.
Browse files Browse the repository at this point in the history
  • Loading branch information
kuujo committed Aug 5, 2015
1 parent c05c372 commit 3b70460
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
8 changes: 3 additions & 5 deletions core/src/main/java/net/kuujo/copycat/Node.java
Expand Up @@ -78,11 +78,9 @@ public CompletableFuture<List<Node>> children() {
return copycat.client.submit(PathChildren.builder() return copycat.client.submit(PathChildren.builder()
.withPath(path) .withPath(path)
.build()) .build())
.thenApply(children -> { .thenApply(children -> children.stream()
return children.stream() .map(copycat::node)
.map(copycat::node) .collect(Collectors.toList()));
.collect(Collectors.toList());
});
} }


/** /**
Expand Down
Expand Up @@ -18,6 +18,7 @@
import net.kuujo.copycat.raft.Operation; import net.kuujo.copycat.raft.Operation;
import net.kuujo.copycat.raft.Session; import net.kuujo.copycat.raft.Session;
import net.kuujo.copycat.raft.server.Commit; import net.kuujo.copycat.raft.server.Commit;
import net.kuujo.copycat.resource.ResourceOperation;


/** /**
* Resource commit. * Resource commit.
Expand All @@ -26,7 +27,7 @@
*/ */
class ResourceCommit implements Commit { class ResourceCommit implements Commit {
private final ResourceCommitPool pool; private final ResourceCommitPool pool;
private Commit commit; private Commit<ResourceOperation> commit;
private Session session; private Session session;


public ResourceCommit(ResourceCommitPool pool) { public ResourceCommit(ResourceCommitPool pool) {
Expand All @@ -39,7 +40,7 @@ public ResourceCommit(ResourceCommitPool pool) {
* @param commit The parent commit. * @param commit The parent commit.
* @param session The resource session. * @param session The resource session.
*/ */
void reset(Commit commit, Session session) { void reset(Commit<ResourceOperation> commit, Session session) {
this.commit = commit; this.commit = commit;
this.session = session; this.session = session;
} }
Expand All @@ -61,12 +62,12 @@ public long timestamp() {


@Override @Override
public Class type() { public Class type() {
return commit.type(); return commit.operation().operation().getClass();
} }


@Override @Override
public Operation operation() { public Operation operation() {
return commit.operation(); return commit.operation().operation();
} }


@Override @Override
Expand Down

0 comments on commit 3b70460

Please sign in to comment.