forked from snowflakedb/snowflake-ingest-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code refactor for Iceberg support (snowflakedb#792)
Co-authored-by: Hitesh Madan <[email protected]>
- Loading branch information
1 parent
ecaec0f
commit 334767d
Showing
25 changed files
with
1,379 additions
and
511 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
49 changes: 49 additions & 0 deletions
49
src/main/java/net/snowflake/ingest/streaming/internal/ClientConfigureRequest.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,49 @@ | ||
/* | ||
* Copyright (c) 2024 Snowflake Computing Inc. All rights reserved. | ||
*/ | ||
|
||
package net.snowflake.ingest.streaming.internal; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
/** Class used to serialize client configure request */ | ||
class ClientConfigureRequest implements IStreamingIngestRequest { | ||
/** | ||
* Constructor for client configure request | ||
* | ||
* @param role Role to be used for the request. | ||
*/ | ||
ClientConfigureRequest(String role) { | ||
this.role = role; | ||
} | ||
|
||
@JsonProperty("role") | ||
private String role; | ||
|
||
// File name for the GCS signed url request | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonProperty("file_name") | ||
private String fileName; | ||
|
||
String getRole() { | ||
return role; | ||
} | ||
|
||
void setRole(String role) { | ||
this.role = role; | ||
} | ||
|
||
String getFileName() { | ||
return fileName; | ||
} | ||
|
||
void setFileName(String fileName) { | ||
this.fileName = fileName; | ||
} | ||
|
||
@Override | ||
public String getStringForLogging() { | ||
return String.format("ClientConfigureRequest(role=%s, file_name=%s)", getRole(), getFileName()); | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
src/main/java/net/snowflake/ingest/streaming/internal/ClientConfigureResponse.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,75 @@ | ||
/* | ||
* Copyright (c) 2024 Snowflake Computing Inc. All rights reserved. | ||
*/ | ||
|
||
package net.snowflake.ingest.streaming.internal; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
/** Class used to deserialize responses from configure endpoint */ | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
class ClientConfigureResponse extends StreamingIngestResponse { | ||
@JsonProperty("prefix") | ||
private String prefix; | ||
|
||
@JsonProperty("status_code") | ||
private Long statusCode; | ||
|
||
@JsonProperty("message") | ||
private String message; | ||
|
||
@JsonProperty("stage_location") | ||
private FileLocationInfo stageLocation; | ||
|
||
@JsonProperty("deployment_id") | ||
private Long deploymentId; | ||
|
||
String getPrefix() { | ||
return prefix; | ||
} | ||
|
||
void setPrefix(String prefix) { | ||
this.prefix = prefix; | ||
} | ||
|
||
@Override | ||
Long getStatusCode() { | ||
return statusCode; | ||
} | ||
|
||
void setStatusCode(Long statusCode) { | ||
this.statusCode = statusCode; | ||
} | ||
|
||
String getMessage() { | ||
return message; | ||
} | ||
|
||
void setMessage(String message) { | ||
this.message = message; | ||
} | ||
|
||
FileLocationInfo getStageLocation() { | ||
return stageLocation; | ||
} | ||
|
||
void setStageLocation(FileLocationInfo stageLocation) { | ||
this.stageLocation = stageLocation; | ||
} | ||
|
||
Long getDeploymentId() { | ||
return deploymentId; | ||
} | ||
|
||
void setDeploymentId(Long deploymentId) { | ||
this.deploymentId = deploymentId; | ||
} | ||
|
||
String getClientPrefix() { | ||
if (this.deploymentId == null) { | ||
return this.prefix; | ||
} | ||
return this.prefix + "_" + this.deploymentId; | ||
} | ||
} |
92 changes: 92 additions & 0 deletions
92
src/main/java/net/snowflake/ingest/streaming/internal/DropChannelRequestInternal.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,92 @@ | ||
/* | ||
* Copyright (c) 2024 Snowflake Computing Inc. All rights reserved. | ||
*/ | ||
|
||
package net.snowflake.ingest.streaming.internal; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import net.snowflake.ingest.streaming.DropChannelRequest; | ||
import net.snowflake.ingest.utils.Utils; | ||
|
||
/** Class used to serialize the {@link DropChannelRequest} */ | ||
class DropChannelRequestInternal implements IStreamingIngestRequest { | ||
@JsonProperty("request_id") | ||
private String requestId; | ||
|
||
@JsonProperty("role") | ||
private String role; | ||
|
||
@JsonProperty("channel") | ||
private String channel; | ||
|
||
@JsonProperty("table") | ||
private String table; | ||
|
||
@JsonProperty("database") | ||
private String database; | ||
|
||
@JsonProperty("schema") | ||
private String schema; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonProperty("client_sequencer") | ||
Long clientSequencer; | ||
|
||
DropChannelRequestInternal( | ||
String requestId, | ||
String role, | ||
String database, | ||
String schema, | ||
String table, | ||
String channel, | ||
Long clientSequencer) { | ||
this.requestId = requestId; | ||
this.role = role; | ||
this.database = database; | ||
this.schema = schema; | ||
this.table = table; | ||
this.channel = channel; | ||
this.clientSequencer = clientSequencer; | ||
} | ||
|
||
String getRequestId() { | ||
return requestId; | ||
} | ||
|
||
String getRole() { | ||
return role; | ||
} | ||
|
||
String getChannel() { | ||
return channel; | ||
} | ||
|
||
String getTable() { | ||
return table; | ||
} | ||
|
||
String getDatabase() { | ||
return database; | ||
} | ||
|
||
String getSchema() { | ||
return schema; | ||
} | ||
|
||
Long getClientSequencer() { | ||
return clientSequencer; | ||
} | ||
|
||
String getFullyQualifiedTableName() { | ||
return Utils.getFullyQualifiedTableName(database, schema, table); | ||
} | ||
|
||
@Override | ||
public String getStringForLogging() { | ||
return String.format( | ||
"DropChannelRequest(requestId=%s, role=%s, db=%s, schema=%s, table=%s, channel=%s," | ||
+ " clientSequencer=%s)", | ||
requestId, role, database, schema, table, channel, clientSequencer); | ||
} | ||
} |
Oops, something went wrong.