Skip to content

Commit 514ea16

Browse files
[state]: native cstore refactor. (#438)
1 parent b89cae5 commit 514ea16

5 files changed

Lines changed: 399 additions & 210 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright 2023 AntGroup CO., Ltd.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
*/
14+
package com.antgroup.geaflow.store.encoder;
15+
16+
import com.antgroup.geaflow.common.type.IType;
17+
import com.antgroup.geaflow.state.schema.GraphDataSchema;
18+
import java.util.function.Function;
19+
20+
public abstract class BaseEncoder {
21+
22+
protected final GraphDataSchema dataSchema;
23+
protected final IType keyType;
24+
protected final Function<Object, byte[]> valueSerializer;
25+
protected final Function<byte[], Object> valueDeserializer;
26+
protected final boolean emptyProperty;
27+
28+
protected BaseEncoder(GraphDataSchema dataSchema) {
29+
this.dataSchema = dataSchema;
30+
this.keyType = dataSchema.getKeyType();
31+
this.valueSerializer = initValueSerializer(dataSchema);
32+
this.valueDeserializer = initValueDeserializer(dataSchema);
33+
this.emptyProperty = initEmptyProperty(dataSchema);
34+
}
35+
36+
protected abstract Function<Object, byte[]> initValueSerializer(GraphDataSchema dataSchema);
37+
38+
protected abstract Function<byte[], Object> initValueDeserializer(GraphDataSchema dataSchema);
39+
40+
protected abstract boolean initEmptyProperty(GraphDataSchema dataSchema);
41+
42+
protected GraphDataSchema getDataSchema() {
43+
return dataSchema;
44+
}
45+
46+
protected Function<Object, byte[]> getValueSerializer() {
47+
return valueSerializer;
48+
}
49+
50+
protected Function<byte[], Object> getValueDeserializer() {
51+
return valueDeserializer;
52+
}
53+
54+
protected boolean isEmptyProperty() {
55+
return emptyProperty;
56+
}
57+
}

geaflow/geaflow-plugins/geaflow-store/geaflow-store-cstore/src/main/java/com/antgroup/geaflow/store/cstore/FilterConverter.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)