-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(interactive): Introduce API to Get Meta Data From Remote Service (#…
…3879) <!-- Thanks for your contribution! please review https://github.com/alibaba/GraphScope/blob/main/CONTRIBUTING.md before opening an issue. --> ## What do these changes do? as titled. <!-- Please give a short brief about these changes. --> ## Related issue number <!-- Are there any issues opened that will be resolved by merging this change? --> Fixes --------- Co-authored-by: xiaolei.zl <xiaolei.zl@alibaba-inc.com> Co-authored-by: Longbin Lai <longbin.lailb@alibaba-inc.com>
- Loading branch information
1 parent
fb308b7
commit 5b53359
Showing
64 changed files
with
918 additions
and
698 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/GraphId.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* | ||
* * Copyright 2020 Alibaba Group Holding Limited. | ||
* * | ||
* * Licensed under the Apache License, Version 2.0 (the "License"); | ||
* * you may not use this file except in compliance with the License. | ||
* * You may obtain a copy of the License at | ||
* * | ||
* * http://www.apache.org/licenses/LICENSE-2.0 | ||
* * | ||
* * Unless required by applicable law or agreed to in writing, software | ||
* * distributed under the License is distributed on an "AS IS" BASIS, | ||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* * See the License for the specific language governing permissions and | ||
* * limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.alibaba.graphscope.common.ir.meta; | ||
|
||
import org.checkerframework.checker.nullness.qual.Nullable; | ||
|
||
/** | ||
* This class is used to uniquely identify a graph instance in scenarios that support multiple graphs. | ||
* @param <T> | ||
*/ | ||
public class GraphId<T> { | ||
public static final GraphId DEFAULT = new GraphId(null); | ||
|
||
private final @Nullable T id; | ||
|
||
public GraphId(T id) { | ||
this.id = id; | ||
} | ||
|
||
public @Nullable T getId() { | ||
return id; | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/IrMeta.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* | ||
* * Copyright 2020 Alibaba Group Holding Limited. | ||
* * | ||
* * Licensed under the Apache License, Version 2.0 (the "License"); | ||
* * you may not use this file except in compliance with the License. | ||
* * You may obtain a copy of the License at | ||
* * | ||
* * http://www.apache.org/licenses/LICENSE-2.0 | ||
* * | ||
* * Unless required by applicable law or agreed to in writing, software | ||
* * distributed under the License is distributed on an "AS IS" BASIS, | ||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* * See the License for the specific language governing permissions and | ||
* * limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.alibaba.graphscope.common.ir.meta; | ||
|
||
import com.alibaba.graphscope.common.ir.meta.procedure.GraphStoredProcedures; | ||
import com.alibaba.graphscope.common.ir.meta.schema.IrGraphSchema; | ||
|
||
import org.checkerframework.checker.nullness.qual.Nullable; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* This class describes basic metadata information required by IR, including Schema, Procedures. | ||
* They are versioned using the same snapshot id. | ||
*/ | ||
public class IrMeta { | ||
protected final GraphId graphId; | ||
protected final SnapshotId snapshotId; | ||
protected final IrGraphSchema schema; | ||
protected final @Nullable GraphStoredProcedures storedProcedures; | ||
|
||
public IrMeta(IrGraphSchema schema) { | ||
this(SnapshotId.createEmpty(), schema); | ||
} | ||
|
||
public IrMeta(IrGraphSchema schema, GraphStoredProcedures storedProcedures) { | ||
this(GraphId.DEFAULT, SnapshotId.createEmpty(), schema, storedProcedures); | ||
} | ||
|
||
public IrMeta(SnapshotId snapshotId, IrGraphSchema schema) { | ||
this(GraphId.DEFAULT, snapshotId, schema, null); | ||
} | ||
|
||
public IrMeta( | ||
GraphId graphId, | ||
SnapshotId snapshotId, | ||
IrGraphSchema schema, | ||
GraphStoredProcedures storedProcedures) { | ||
this.graphId = graphId; | ||
this.snapshotId = Objects.requireNonNull(snapshotId); | ||
this.schema = Objects.requireNonNull(schema); | ||
this.storedProcedures = storedProcedures; | ||
} | ||
|
||
public IrGraphSchema getSchema() { | ||
return schema; | ||
} | ||
|
||
public SnapshotId getSnapshotId() { | ||
return snapshotId; | ||
} | ||
|
||
public @Nullable GraphStoredProcedures getStoredProcedures() { | ||
return storedProcedures; | ||
} | ||
|
||
public GraphId getGraphId() { | ||
return graphId; | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
...tive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/IrMetaStats.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* | ||
* * Copyright 2020 Alibaba Group Holding Limited. | ||
* * | ||
* * Licensed under the Apache License, Version 2.0 (the "License"); | ||
* * you may not use this file except in compliance with the License. | ||
* * You may obtain a copy of the License at | ||
* * | ||
* * http://www.apache.org/licenses/LICENSE-2.0 | ||
* * | ||
* * Unless required by applicable law or agreed to in writing, software | ||
* * distributed under the License is distributed on an "AS IS" BASIS, | ||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* * See the License for the specific language governing permissions and | ||
* * limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.alibaba.graphscope.common.ir.meta; | ||
|
||
import com.alibaba.graphscope.common.ir.meta.procedure.GraphStoredProcedures; | ||
import com.alibaba.graphscope.common.ir.meta.schema.IrGraphSchema; | ||
import com.alibaba.graphscope.groot.common.schema.api.GraphStatistics; | ||
|
||
import org.checkerframework.checker.nullness.qual.Nullable; | ||
|
||
/** | ||
* This class describes all metadata information required by IR, including Schema, Procedures and Statistics. | ||
*/ | ||
public class IrMetaStats extends IrMeta { | ||
private final @Nullable GraphStatistics statistics; | ||
|
||
public IrMetaStats( | ||
SnapshotId snapshotId, | ||
IrGraphSchema schema, | ||
GraphStoredProcedures storedProcedures, | ||
GraphStatistics statistics) { | ||
this(GraphId.DEFAULT, snapshotId, schema, storedProcedures, statistics); | ||
} | ||
|
||
public IrMetaStats( | ||
GraphId graphId, | ||
SnapshotId snapshotId, | ||
IrGraphSchema schema, | ||
GraphStoredProcedures storedProcedures, | ||
GraphStatistics statistics) { | ||
super(graphId, snapshotId, schema, storedProcedures); | ||
this.statistics = statistics; | ||
} | ||
|
||
public @Nullable GraphStatistics getStatistics() { | ||
return this.statistics; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...ve_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/IrMetaTracker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* | ||
* * Copyright 2020 Alibaba Group Holding Limited. | ||
* * | ||
* * Licensed under the Apache License, Version 2.0 (the "License"); | ||
* * you may not use this file except in compliance with the License. | ||
* * You may obtain a copy of the License at | ||
* * | ||
* * http://www.apache.org/licenses/LICENSE-2.0 | ||
* * | ||
* * Unless required by applicable law or agreed to in writing, software | ||
* * distributed under the License is distributed on an "AS IS" BASIS, | ||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* * See the License for the specific language governing permissions and | ||
* * limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.alibaba.graphscope.common.ir.meta; | ||
|
||
// This interface defines the callback to be invoked when IrMeta changes. | ||
public interface IrMetaTracker { | ||
void onChanged(IrMeta meta); | ||
} |
41 changes: 41 additions & 0 deletions
41
...ctive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/SnapshotId.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* | ||
* * Copyright 2020 Alibaba Group Holding Limited. | ||
* * | ||
* * Licensed under the Apache License, Version 2.0 (the "License"); | ||
* * you may not use this file except in compliance with the License. | ||
* * You may obtain a copy of the License at | ||
* * | ||
* * http://www.apache.org/licenses/LICENSE-2.0 | ||
* * | ||
* * Unless required by applicable law or agreed to in writing, software | ||
* * distributed under the License is distributed on an "AS IS" BASIS, | ||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* * See the License for the specific language governing permissions and | ||
* * limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.alibaba.graphscope.common.ir.meta; | ||
|
||
public class SnapshotId { | ||
public static final SnapshotId createEmpty() { | ||
return new SnapshotId(false, -1); | ||
} | ||
|
||
private final boolean acquired; | ||
private final long id; | ||
|
||
public SnapshotId(boolean acquired, long id) { | ||
this.acquired = acquired; | ||
this.id = id; | ||
} | ||
|
||
public boolean isAcquired() { | ||
return acquired; | ||
} | ||
|
||
public long getId() { | ||
return id; | ||
} | ||
} |
Oops, something went wrong.