Skip to content

Commit 496be62

Browse files
authored
refactor some core class part5 (#5)
1 parent c958c52 commit 496be62

File tree

68 files changed

+192
-192
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+192
-192
lines changed

src/main/java/io/r2dbc/gaussdb/GaussDBColumnMetadata.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public int hashCode() {
110110

111111
@Override
112112
public String toString() {
113-
return "PostgresqlColumnMetadata{" +
113+
return "GaussDBColumnMetadata{" +
114114
", name='" + this.name + '\'' +
115115
", nativeType=" + this.nativeType +
116116
", precision=" + this.precision +

src/main/java/io/r2dbc/gaussdb/GaussDBConnectionFactory.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ private Throwable cannotConnect(Throwable throwable, ConnectionStrategy strategy
186186
return throwable;
187187
}
188188

189-
return new PostgresConnectionException(String.format("Cannot connect to %s", strategy), throwable);
189+
return new GaussDBConnectionException(String.format("Cannot connect to %s", strategy), throwable);
190190
}
191191

192192
@Override
@@ -221,13 +221,13 @@ private Mono<IsolationLevel> getIsolationLevel(io.r2dbc.gaussdb.api.GaussDBConne
221221
})).defaultIfEmpty(IsolationLevel.READ_COMMITTED).last();
222222
}
223223

224-
static class PostgresConnectionException extends R2dbcNonTransientResourceException implements GaussDBException {
224+
static class GaussDBConnectionException extends R2dbcNonTransientResourceException implements GaussDBException {
225225

226226
private static final String CONNECTION_DOES_NOT_EXIST = "08003";
227227

228228
private final ErrorDetails errorDetails;
229229

230-
public PostgresConnectionException(String reason, @Nullable Throwable cause) {
230+
public GaussDBConnectionException(String reason, @Nullable Throwable cause) {
231231
super(reason, CONNECTION_DOES_NOT_EXIST, 0, null, cause);
232232
this.errorDetails = ErrorDetails.fromCodeAndMessage(CONNECTION_DOES_NOT_EXIST, reason);
233233
}

src/main/java/io/r2dbc/gaussdb/GaussDBCopyIn.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private void copyFail(Sinks.Many<FrontendMessage> sink, AtomicBoolean stop, Stri
129129

130130
@Override
131131
public String toString() {
132-
return "PostgresqlCopyIn{" +
132+
return "GaussDBCopyIn{" +
133133
"context=" + this.context +
134134
'}';
135135
}

src/main/java/io/r2dbc/gaussdb/GaussDBReplicationStream.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
final class GaussDBReplicationStream implements ReplicationStream {
4646

47-
public static final long POSTGRES_EPOCH_2000_01_01 = 946684800000L;
47+
public static final long GAUSSDB_EPOCH_2000_01_01 = 946684800000L;
4848

4949
private static final char KEEP_ALIVE = 'k';
5050

@@ -175,7 +175,7 @@ private ByteBuf prepareUpdateStatus(LogSequenceNumber received, LogSequenceNumbe
175175

176176
long now = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
177177
// consider range bounds
178-
long systemClock = TimeUnit.MICROSECONDS.convert((now - POSTGRES_EPOCH_2000_01_01), TimeUnit.MICROSECONDS);
178+
long systemClock = TimeUnit.MICROSECONDS.convert((now - GAUSSDB_EPOCH_2000_01_01), TimeUnit.MICROSECONDS);
179179

180180
return new KeepAliveMessage(received, flushed, applied, systemClock, replyRequired).encode(this.allocator);
181181
}

src/main/java/io/r2dbc/gaussdb/GaussDBResult.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public ReferenceCounted touch(Object hint) {
159159

160160
@Override
161161
public String toString() {
162-
return "PostgresqlResult{" +
162+
return "GaussDBResult{" +
163163
"context=" + this.resources +
164164
", messages=" + this.messages +
165165
'}';

src/main/java/io/r2dbc/gaussdb/GaussDBSegmentResult.java

+18-18
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,20 @@ private GaussDBSegmentResult(Flux<Segment> segments) {
7373
}).handle((message, sink) -> {
7474

7575
if (message instanceof ErrorResponse) {
76-
sink.next(new PostgresErrorSegment((ErrorResponse) message, factory));
76+
sink.next(new GaussDBErrorSegment((ErrorResponse) message, factory));
7777
return;
7878
}
7979

8080
if (message instanceof NoticeResponse) {
81-
sink.next(new PostgresNoticeSegment((NoticeResponse) message, factory));
81+
sink.next(new GaussDBNoticeSegment((NoticeResponse) message, factory));
8282
return;
8383
}
8484

8585
if (message instanceof CommandComplete) {
8686

8787
Long rowCount = ((CommandComplete) message).getRows();
8888
if (rowCount != null) {
89-
sink.next(new PostgresqlUpdateCountSegment(rowCount));
89+
sink.next(new GaussDBUpdateCountSegment(rowCount));
9090
}
9191
return;
9292
}
@@ -102,11 +102,11 @@ private GaussDBSegmentResult(Flux<Segment> segments) {
102102
}
103103

104104
if (metadata == null) {
105-
sink.error(new IllegalStateException("DataRow without PostgresqlRowMetadata"));
105+
sink.error(new IllegalStateException("DataRow without GaussDBRowMetadata"));
106106
return;
107107
}
108108

109-
sink.next(new PostgresqlRowSegment(GaussDBRow.toRow(resources, (DataRow) message, metadata, rowDescription), (DataRow) message));
109+
sink.next(new GaussDBRowSegment(GaussDBRow.toRow(resources, (DataRow) message, metadata, rowDescription), (DataRow) message));
110110
return;
111111
}
112112

@@ -120,8 +120,8 @@ public Mono<Long> getRowsUpdated() {
120120
.<Integer>handle((segment, sink) -> {
121121

122122
try {
123-
if (segment instanceof PostgresErrorSegment) {
124-
sink.error(((PostgresErrorSegment) segment).exception());
123+
if (segment instanceof GaussDBErrorSegment) {
124+
sink.error(((GaussDBErrorSegment) segment).exception());
125125
return;
126126
}
127127

@@ -156,8 +156,8 @@ public <T> Flux<T> map(BiFunction<Row, RowMetadata, ? extends T> f) {
156156
.handle((segment, sink) -> {
157157

158158
try {
159-
if (segment instanceof PostgresErrorSegment) {
160-
sink.error(((PostgresErrorSegment) segment).exception());
159+
if (segment instanceof GaussDBErrorSegment) {
160+
sink.error(((GaussDBErrorSegment) segment).exception());
161161
return;
162162
}
163163

@@ -222,7 +222,7 @@ public ReferenceCounted touch(Object hint) {
222222

223223
@Override
224224
public String toString() {
225-
return "PostgresqlSegmentResult{" +
225+
return "GaussDBSegmentResult{" +
226226
"segments=" + this.segments +
227227
'}';
228228
}
@@ -231,13 +231,13 @@ static GaussDBSegmentResult toResult(ConnectionResources resources, Flux<Backend
231231
return new GaussDBSegmentResult(resources, messages, factory);
232232
}
233233

234-
static class PostgresqlRowSegment extends AbstractReferenceCounted implements Result.RowSegment {
234+
static class GaussDBRowSegment extends AbstractReferenceCounted implements Result.RowSegment {
235235

236236
private final Row row;
237237

238238
private final ReferenceCounted releaseable;
239239

240-
public PostgresqlRowSegment(Row row, ReferenceCounted releaseable) {
240+
public GaussDBRowSegment(Row row, ReferenceCounted releaseable) {
241241
this.row = row;
242242
this.releaseable = releaseable;
243243
}
@@ -259,11 +259,11 @@ public ReferenceCounted touch(Object hint) {
259259

260260
}
261261

262-
static class PostgresqlUpdateCountSegment implements Result.UpdateCount {
262+
static class GaussDBUpdateCountSegment implements Result.UpdateCount {
263263

264264
private final long value;
265265

266-
public PostgresqlUpdateCountSegment(long value) {
266+
public GaussDBUpdateCountSegment(long value) {
267267
this.value = value;
268268
}
269269

@@ -274,13 +274,13 @@ public long value() {
274274

275275
}
276276

277-
static class PostgresErrorSegment implements Result.Message {
277+
static class GaussDBErrorSegment implements Result.Message {
278278

279279
private final ExceptionFactory factory;
280280

281281
private final ErrorDetails details;
282282

283-
public PostgresErrorSegment(ErrorResponse response, ExceptionFactory factory) {
283+
public GaussDBErrorSegment(ErrorResponse response, ExceptionFactory factory) {
284284
this.factory = factory;
285285
this.details = new ErrorDetails(response.getFields());
286286
}
@@ -307,13 +307,13 @@ public String message() {
307307

308308
}
309309

310-
static class PostgresNoticeSegment implements Result.Message {
310+
static class GaussDBNoticeSegment implements Result.Message {
311311

312312
private final ExceptionFactory factory;
313313

314314
private final ErrorDetails details;
315315

316-
public PostgresNoticeSegment(NoticeResponse response, ExceptionFactory factory) {
316+
public GaussDBNoticeSegment(NoticeResponse response, ExceptionFactory factory) {
317317
this.factory = factory;
318318
this.details = new ErrorDetails(response.getFields());
319319
}

src/main/java/io/r2dbc/gaussdb/GaussDBStatement.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public GaussDBStatement fetchSize(int rows) {
173173

174174
@Override
175175
public String toString() {
176-
return "PostgresqlStatement{" +
176+
return "GaussDBStatement{" +
177177
"bindings=" + this.bindings +
178178
", context=" + this.resources +
179179
", sql='" + this.parsedSql.getSql() + '\'' +

src/main/java/io/r2dbc/gaussdb/MultiHostConnectionStrategy.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ public Mono<Client> connect(TargetServerType targetServerType) {
9696
.switchIfEmpty(Mono.error(() -> {
9797
Throwable error = exceptionRef.get();
9898
if (error == null) {
99-
return new GaussDBConnectionFactory.PostgresConnectionException(String.format("No server matches target type '%s'", targetServerType), null);
99+
return new GaussDBConnectionFactory.GaussDBConnectionException(String.format("No server matches target type '%s'", targetServerType), null);
100100
} else {
101-
return new GaussDBConnectionFactory.PostgresConnectionException(String.format("Cannot connect to a host of %s", this.addresses), error);
101+
return new GaussDBConnectionFactory.GaussDBConnectionException(String.format("Cannot connect to a host of %s", this.addresses), error);
102102
}
103103
}));
104104
}

src/main/java/io/r2dbc/gaussdb/api/CopyInBuilder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
public interface CopyInBuilder {
3333

3434
/**
35-
* Postgres parse limit for large messages {@code 2^30 - 1} bytes.
35+
* GaussDB parse limit for large messages {@code 2^30 - 1} bytes.
3636
*/
3737
int MAX_FRAME_SIZE = 0x3fffffff - 1;
3838

src/main/java/io/r2dbc/gaussdb/api/GaussDBTransactionDefinition.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
public interface GaussDBTransactionDefinition extends TransactionDefinition {
2929

3030
/**
31-
* The {@code DEFERRABLE} transaction_mode is a PostgreSQL language extension.
31+
* The {@code DEFERRABLE} transaction_mode is a GaussDB language extension.
3232
*/
3333
Option<Boolean> DEFERRABLE = Option.valueOf("deferrable");
3434

src/main/java/io/r2dbc/gaussdb/api/Notification.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import reactor.util.annotation.Nullable;
2020

2121
/**
22-
* Postgres notification received via {@code LISTEN}.
22+
* GaussDB notification received via {@code LISTEN}.
2323
*/
2424
public interface Notification {
2525

src/main/java/io/r2dbc/gaussdb/api/package-info.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
/**
18-
* R2DBC driver API with Postgres-specific extensions.
18+
* R2DBC driver API with GaussDB-specific extensions.
1919
*/
2020

2121
@NonNullApi

src/main/java/io/r2dbc/gaussdb/client/AbstractPostgresSSLHandlerAdapter.java src/main/java/io/r2dbc/gaussdb/client/AbstractGaussDBSSLHandlerAdapter.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import java.net.SocketAddress;
3434
import java.util.concurrent.CompletableFuture;
3535

36-
abstract class AbstractPostgresSSLHandlerAdapter extends ChannelInboundHandlerAdapter implements GenericFutureListener<Future<Channel>> {
36+
abstract class AbstractGaussDBSSLHandlerAdapter extends ChannelInboundHandlerAdapter implements GenericFutureListener<Future<Channel>> {
3737

3838
private final SSLConfig sslConfig;
3939

@@ -43,7 +43,7 @@ abstract class AbstractPostgresSSLHandlerAdapter extends ChannelInboundHandlerAd
4343

4444
private final CompletableFuture<Void> handshakeFuture;
4545

46-
AbstractPostgresSSLHandlerAdapter(ByteBufAllocator alloc, SocketAddress socketAddress, SSLConfig sslConfig) {
46+
AbstractGaussDBSSLHandlerAdapter(ByteBufAllocator alloc, SocketAddress socketAddress, SSLConfig sslConfig) {
4747
this.sslConfig = sslConfig;
4848

4949
SSLEngine sslEngine = sslConfig.getSslProvider().get().newEngine(alloc);
@@ -93,7 +93,7 @@ SslHandler getSslHandler() {
9393
}
9494

9595
/**
96-
* Postgres-specific {@link R2dbcPermissionDeniedException}.
96+
* GaussDB-specific {@link R2dbcPermissionDeniedException}.
9797
*/
9898
static final class GaussDBSslException extends R2dbcPermissionDeniedException implements GaussDBException {
9999

src/main/java/io/r2dbc/gaussdb/client/BalancedResolverGroup.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ final class BalancedResolverGroup extends AddressResolverGroup<InetSocketAddress
3939
static {
4040

4141
INSTANCE = new BalancedResolverGroup();
42-
Runtime.getRuntime().addShutdownHook(new Thread(INSTANCE::close, "R2DBC-Postgresql-BalancedResolverGroup-ShutdownHook"));
42+
Runtime.getRuntime().addShutdownHook(new Thread(INSTANCE::close, "R2DBC-GaussDB-BalancedResolverGroup-ShutdownHook"));
4343
}
4444

4545
@Override

src/main/java/io/r2dbc/gaussdb/client/ConnectionContext.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* Value object capturing diagnostic connection context. Allows for log-message post-processing with {@link #getMessage(String) if the logger category for
2929
* {@code ConnectionContext} is enabled for DEBUG/TRACE logs.
3030
* <p>
31-
* Captures also the Postgres process Id.
31+
* Captures also the GaussDB process Id.
3232
*
3333
* @since 0.8.6
3434
*/
@@ -135,7 +135,7 @@ public ConnectionContext withSslSession(Supplier<SSLSession> sslSession) {
135135
/**
136136
* Create a new {@link ConnectionContext} by associating the {@code processId}.
137137
*
138-
* @param processId the Postgres processId.
138+
* @param processId the GaussDB processId.
139139
* @return a new {@link ConnectionContext} with all previously set values and the associated {@code processId}.
140140
*/
141141
public ConnectionContext withProcessId(int processId) {

src/main/java/io/r2dbc/gaussdb/client/GaussDBStartupParameterProvider.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void accept(StartupMessage.ParameterWriter writer) {
5656
writer.write("client_encoding", "utf8");
5757
writer.write("DateStyle", "ISO");
5858
writer.write("extra_float_digits", "2");
59-
writer.write("TimeZone", TimeZoneUtils.createPostgresTimeZone(this.timeZone));
59+
writer.write("TimeZone", TimeZoneUtils.createGaussDBTimeZone(this.timeZone));
6060

6161
if (this.options != null) {
6262
for (Map.Entry<String, String> option : this.options.entrySet()) {

src/main/java/io/r2dbc/gaussdb/client/MultiHostConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import static io.r2dbc.gaussdb.GaussDBConnectionConfiguration.DEFAULT_PORT;
2828

2929
/**
30-
* Connection configuration information for connecting to a cluster of Postgres servers.
30+
* Connection configuration information for connecting to a cluster of GaussDB servers.
3131
*
3232
* @since 1.0
3333
*/

0 commit comments

Comments
 (0)