-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Done with code changes - need to add tests
- Loading branch information
1 parent
72c4004
commit 06dc34d
Showing
15 changed files
with
328 additions
and
59 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
103 changes: 103 additions & 0 deletions
103
src/main/java/net/snowflake/ingest/streaming/DropChannelRequest.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,103 @@ | ||
/* | ||
* Copyright (c) 2021 Snowflake Computing Inc. All rights reserved. | ||
*/ | ||
|
||
package net.snowflake.ingest.streaming; | ||
|
||
import net.snowflake.ingest.utils.Utils; | ||
|
||
/** A class that is used to open/create a {@link SnowflakeStreamingIngestChannel} */ | ||
public class DropChannelRequest { | ||
// Name of the channel | ||
private final String channelName; | ||
|
||
// Name of the database that the channel belongs to | ||
private final String dbName; | ||
|
||
// Name of the schema that the channel belongs to | ||
private final String schemaName; | ||
|
||
// Name of the table that the channel belongs to | ||
private final String tableName; | ||
|
||
private final Long clientSequencer; | ||
|
||
public static DropChannelRequestBuilder builder(String channelName) { | ||
return new DropChannelRequestBuilder(channelName); | ||
} | ||
|
||
/** A builder class to build a OpenChannelRequest */ | ||
public static class DropChannelRequestBuilder { | ||
private final String channelName; | ||
private String dbName; | ||
private String schemaName; | ||
private String tableName; | ||
|
||
private Long clientSequencer = null; | ||
|
||
public DropChannelRequestBuilder(String channelName) { | ||
this.channelName = channelName; | ||
} | ||
|
||
public DropChannelRequestBuilder setDBName(String dbName) { | ||
this.dbName = dbName; | ||
return this; | ||
} | ||
|
||
public DropChannelRequestBuilder setSchemaName(String schemaName) { | ||
this.schemaName = schemaName; | ||
return this; | ||
} | ||
|
||
public DropChannelRequestBuilder setTableName(String tableName) { | ||
this.tableName = tableName; | ||
return this; | ||
} | ||
|
||
public DropChannelRequestBuilder setClientSequencer(Long clientSequencer) { | ||
this.clientSequencer = clientSequencer; | ||
return this; | ||
} | ||
|
||
public DropChannelRequest build() { | ||
return new DropChannelRequest(this); | ||
} | ||
} | ||
|
||
private DropChannelRequest(DropChannelRequestBuilder builder) { | ||
Utils.assertStringNotNullOrEmpty("channel name", builder.channelName); | ||
Utils.assertStringNotNullOrEmpty("database name", builder.dbName); | ||
Utils.assertStringNotNullOrEmpty("schema name", builder.schemaName); | ||
Utils.assertStringNotNullOrEmpty("table name", builder.tableName); | ||
|
||
this.channelName = builder.channelName; | ||
this.dbName = builder.dbName; | ||
this.schemaName = builder.schemaName; | ||
this.tableName = builder.tableName; | ||
this.clientSequencer = builder.clientSequencer; | ||
} | ||
|
||
public String getDBName() { | ||
return this.dbName; | ||
} | ||
|
||
public String getSchemaName() { | ||
return this.schemaName; | ||
} | ||
|
||
public String getTableName() { | ||
return this.tableName; | ||
} | ||
|
||
public String getChannelName() { | ||
return this.channelName; | ||
} | ||
|
||
public String getFullyQualifiedTableName() { | ||
return String.format("%s.%s.%s", this.dbName, this.schemaName, this.tableName); | ||
} | ||
|
||
public Long getClientSequencer() { | ||
return this.clientSequencer; | ||
} | ||
} |
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
67 changes: 67 additions & 0 deletions
67
src/main/java/net/snowflake/ingest/streaming/internal/DropChannelResponse.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,67 @@ | ||
package net.snowflake.ingest.streaming.internal; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
public class DropChannelResponse extends StreamingIngestResponse { | ||
private Long statusCode; | ||
private String message; | ||
private String dbName; | ||
private String schemaName; | ||
private String tableName; | ||
private String channelName; | ||
|
||
@JsonProperty("status_code") | ||
void setStatusCode(Long statusCode) { | ||
this.statusCode = statusCode; | ||
} | ||
|
||
@Override | ||
Long getStatusCode() { | ||
return this.statusCode; | ||
} | ||
|
||
@JsonProperty("message") | ||
void setMessage(String message) { | ||
this.message = message; | ||
} | ||
|
||
String getMessage() { | ||
return this.message; | ||
} | ||
|
||
@JsonProperty("database") | ||
void setDBName(String dbName) { | ||
this.dbName = dbName; | ||
} | ||
|
||
String getDBName() { | ||
return this.dbName; | ||
} | ||
|
||
@JsonProperty("schema") | ||
void setSchemaName(String schemaName) { | ||
this.schemaName = schemaName; | ||
} | ||
|
||
String getSchemaName() { | ||
return this.schemaName; | ||
} | ||
|
||
@JsonProperty("table") | ||
void setTableName(String tableName) { | ||
this.tableName = tableName; | ||
} | ||
|
||
String getTableName() { | ||
return this.tableName; | ||
} | ||
|
||
@JsonProperty("channel") | ||
void setChannelName(String channelName) { | ||
this.channelName = channelName; | ||
} | ||
|
||
String getChannelName() { | ||
return this.channelName; | ||
} | ||
} |
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
Oops, something went wrong.