SkrDrag commented on issue #2412:
URL:
https://github.com/apache/incubator-hugegraph/issues/2412#issuecomment-1885131317
> _🤖_
>
> Based on the information available in the HugeGraph codebase, there is no
explicit difference between the interfaces for querying a remote database and a
local database. The methods provided in the `GraphTransaction.java` file, such
as `queryEdgesByVertex(Id id)`, `queryEdges(Object... edgeIds)`,
`queryEdge(Object edgeId)`, and `queryEdges()` are used to query edges in the
graph database, regardless of whether the database is local or remote.
>
> The actual difference between querying a local or remote database would
likely be handled at a lower level, such as the connection to the database. The
same methods would be used to query the database, but the underlying
implementation of those methods would handle the specifics of connecting to and
querying a local or remote database.
>
> As for the specific methods in the `GraphTransaction.java` file that
handle the connection to the database, the `GraphTransaction.java` file does
not contain any specific methods that handle the connection to the database.
The file primarily contains methods for managing transactions, including
adding, updating, and deleting vertices and edges, as well as handling
properties and indices.
>
> The connection to the database is likely managed elsewhere in the
codebase, possibly in the `BackendStore` class or another class that interacts
directly with the database. The `GraphTransaction` class appears to interact
with the database indirectly through these other classes.
>
> For example, the `GraphTransaction` constructor takes a `BackendStore`
object as an argument, which is likely used to interact with the database:
>
> ```java
> public GraphTransaction(HugeGraphParams graph, BackendStore store) {
> super(graph, store);
> ...
> }
> ```
>
> And the `prepareCommit` method prepares the data to be committed to the
database, but does not itself handle the database connection:
>
> ```java
> @Watched(prefix = "tx")
> @Override
> protected BackendMutation prepareCommit() {
> ...
> return this.mutation();
> }
> ```
>
> Without additional context or access to other parts of the codebase, it's
not possible to provide more specific information about how the database
connection is handled. If you have more specific questions or need further
clarification, please provide more details.
>
> ## Sources
> *
[hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java)
>
> This response is meant to be useful and save you time. It is **not meant
to be a precise solution**, but rather a starting point for your own research.
>
> Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is
irrelevant.
>
> If you want to continue the conversation, start your reply with @dosu-bot.
可以解释一下BackendStore类如何与数据库连接吗
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]