Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve shard deserialize #34

Merged
merged 1 commit into from
Jan 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/main/java/com/baidu/hugegraph/client/RestClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@
import com.baidu.hugegraph.exception.ServerException;
import com.baidu.hugegraph.rest.RestResult;
import com.baidu.hugegraph.serializer.PathDeserializer;
import com.baidu.hugegraph.serializer.ShardDeserializer;
import com.baidu.hugegraph.serializer.VertexDeserializer;
import com.baidu.hugegraph.structure.graph.Path;
import com.baidu.hugegraph.structure.graph.Shard;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.fasterxml.jackson.databind.module.SimpleModule;

Expand All @@ -39,7 +37,6 @@ public class RestClient extends com.baidu.hugegraph.rest.RestClient {
SimpleModule module = new SimpleModule();
module.addDeserializer(Vertex.class, new VertexDeserializer());
module.addDeserializer(Path.class, new PathDeserializer());
module.addDeserializer(Shard.class, new ShardDeserializer());
RestResult.registerModule(module);
}

Expand Down

This file was deleted.

11 changes: 8 additions & 3 deletions src/main/java/com/baidu/hugegraph/structure/graph/Shard.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,25 @@

package com.baidu.hugegraph.structure.graph;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
* Shard is used for backend storage (like cassandra, hbase) scanning
* operations. Each shard represents a range of tokens for a node.
* Reading data from a given shard does not cross multiple nodes.
*/
public class Shard {

// token range start
@JsonProperty("start")
private String start;
// token range end
@JsonProperty("end")
private String end;
// partitions count in this range
@JsonProperty("length")
private long length;

public Shard() {
}

public Shard(String start, String end, long length) {
this.start = start;
this.end = end;
Expand Down