|
10 | 10 | import org.slf4j.LoggerFactory; |
11 | 11 | import tech.ydb.core.Result; |
12 | 12 | import tech.ydb.core.Status; |
13 | | -import tech.ydb.core.grpc.GrpcTransport; |
14 | 13 | import tech.ydb.proto.ValueProtos; |
15 | 14 | import tech.ydb.scheme.SchemeClient; |
16 | 15 | import tech.ydb.scheme.description.DescribePathResult; |
|
42 | 41 | import tech.ydb.yoj.repository.ydb.exception.YdbSchemaPathNotFoundException; |
43 | 42 | import tech.ydb.yoj.repository.ydb.yql.YqlPrimitiveType; |
44 | 43 | import tech.ydb.yoj.repository.ydb.yql.YqlType; |
45 | | -import tech.ydb.yoj.util.lang.Exceptions; |
46 | 44 |
|
47 | 45 | import java.util.ArrayList; |
48 | 46 | import java.util.List; |
|
58 | 56 | import static lombok.AccessLevel.PRIVATE; |
59 | 57 | import static tech.ydb.core.StatusCode.SCHEME_ERROR; |
60 | 58 |
|
61 | | -@Getter |
62 | 59 | @InternalApi |
63 | | -public final class YdbSchemaOperations implements AutoCloseable { |
| 60 | +public final class YdbSchemaOperations { |
64 | 61 | private static final Logger log = LoggerFactory.getLogger(YdbSchemaOperations.class); |
65 | 62 |
|
| 63 | + @Getter |
| 64 | + private String tablespace; |
66 | 65 | private final SessionManager sessionManager; |
67 | 66 | private final SchemeClient schemeClient; |
68 | 67 | private final TopicClient topicClient; |
69 | | - private String tablespace; |
70 | 68 |
|
71 | | - public YdbSchemaOperations(String tablespace, @NonNull SessionManager sessionManager, GrpcTransport transport) { |
| 69 | + public YdbSchemaOperations( |
| 70 | + String tablespace, |
| 71 | + SessionManager sessionManager, |
| 72 | + SchemeClient schemeClient, |
| 73 | + TopicClient topicClient |
| 74 | + ) { |
72 | 75 | this.tablespace = YdbPaths.canonicalTablespace(tablespace); |
73 | 76 | this.sessionManager = sessionManager; |
74 | | - this.schemeClient = SchemeClient.newClient(transport).build(); |
75 | | - this.topicClient = TopicClient.newClient(transport).build(); |
| 77 | + this.schemeClient = schemeClient; |
| 78 | + this.topicClient = topicClient; |
76 | 79 | } |
77 | 80 |
|
78 | 81 | public void setTablespace(String tablespace) { |
@@ -476,11 +479,6 @@ public boolean hasPath(String path) { |
476 | 479 | throw new YdbRepositoryException("Can't describe table '" + path + "': " + result); |
477 | 480 | } |
478 | 481 |
|
479 | | - @Override |
480 | | - public void close() { |
481 | | - Exceptions.closeAll(topicClient, schemeClient); |
482 | | - } |
483 | | - |
484 | 482 | @Value |
485 | 483 | private static class DirectoryEntity { |
486 | 484 | EntryType type; |
|
0 commit comments