Class SnowflakeStreamingIngestClientInternal<T>
- java.lang.Object
-
- net.snowflake.ingest.streaming.internal.SnowflakeStreamingIngestClientInternal<T>
-
- Type Parameters:
T
- type of column data (ParquetChunkData
)
- All Implemented Interfaces:
AutoCloseable
,SnowflakeStreamingIngestClient
public class SnowflakeStreamingIngestClientInternal<T> extends Object implements SnowflakeStreamingIngestClient
The first version of implementation for SnowflakeStreamingIngestClient. The client internally manages a few things:- the channel cache, which contains all the channels that belong to this account
- the flush service, which schedules and coordinates the flush to Snowflake tables
-
-
Constructor Summary
Constructors Constructor Description SnowflakeStreamingIngestClientInternal(String name, SnowflakeURL accountURL, Properties prop, Map<String,Object> parameterOverrides, boolean isTestMode)
Default Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the client, which will flush first and then release all the resourcesvoid
dropChannel(DropChannelRequest request)
Drop the specified channel on the server using aDropChannelRequest
Map<FullyQualifiedTableName,EncryptionKey>
getEncryptionKeysPerTable()
Map<String,String>
getLatestCommittedOffsetTokens(List<SnowflakeStreamingIngestChannel> channels)
Return the latest committed/persisted offset token for all channelsString
getName()
Get the client namevoid
injectRequestBuilder(RequestBuilder requestBuilder)
boolean
isClosed()
Check whether the client is closed or not, if you want to make sure all data are committed before closing, please callAutoCloseable.close()
before closing the entire clientnet.snowflake.ingest.streaming.internal.SnowflakeStreamingIngestChannelInternal<?>
openChannel(OpenChannelRequest request)
Open a channel against a Snowflake tablevoid
setRefreshToken(String refreshToken)
Set refresh token, this method is for refresh token renewal without requiring to restart client.void
setStorageManager(net.snowflake.ingest.streaming.internal.IStorageManager storageManager)
-
-
-
Constructor Detail
-
SnowflakeStreamingIngestClientInternal
public SnowflakeStreamingIngestClientInternal(String name, SnowflakeURL accountURL, Properties prop, Map<String,Object> parameterOverrides, boolean isTestMode)
Default Constructor- Parameters:
name
- the name of the clientaccountURL
- Snowflake account urlprop
- connection propertiesparameterOverrides
- map of parameters to override for this clientisTestMode
- indicates whether it's under test mode
-
-
Method Detail
-
injectRequestBuilder
public void injectRequestBuilder(RequestBuilder requestBuilder)
-
getName
public String getName()
Get the client name- Specified by:
getName
in interfaceSnowflakeStreamingIngestClient
- Returns:
- the client name
-
isClosed
public boolean isClosed()
Description copied from interface:SnowflakeStreamingIngestClient
Check whether the client is closed or not, if you want to make sure all data are committed before closing, please callAutoCloseable.close()
before closing the entire client- Specified by:
isClosed
in interfaceSnowflakeStreamingIngestClient
- Returns:
- a boolean to indicate whether the client is closed or not
-
openChannel
public net.snowflake.ingest.streaming.internal.SnowflakeStreamingIngestChannelInternal<?> openChannel(OpenChannelRequest request)
Open a channel against a Snowflake table- Specified by:
openChannel
in interfaceSnowflakeStreamingIngestClient
- Parameters:
request
- the open channel request- Returns:
- a SnowflakeStreamingIngestChannel object
-
dropChannel
public void dropChannel(DropChannelRequest request)
Description copied from interface:SnowflakeStreamingIngestClient
Drop the specified channel on the server using aDropChannelRequest
Note that this call will blindly drop the latest version of the channel and any pending data will be lost. It will also delete Offset Token and other state from Snowflake servers. So only use it if you are completely done ingesting data for this channel. If you open a channel with the same name in the future, it will behave like a new channel.
Also see
SnowflakeStreamingIngestChannel.close(boolean)
to drop channels on close. That approach will drop the local version of the channel and if the channel has been concurrently reopened by another client, that version of the channel won't be affected.- Specified by:
dropChannel
in interfaceSnowflakeStreamingIngestClient
- Parameters:
request
- the drop channel request
-
getLatestCommittedOffsetTokens
public Map<String,String> getLatestCommittedOffsetTokens(List<SnowflakeStreamingIngestChannel> channels)
Return the latest committed/persisted offset token for all channels- Specified by:
getLatestCommittedOffsetTokens
in interfaceSnowflakeStreamingIngestClient
- Returns:
- map of channel to the latest persisted offset token
-
close
public void close() throws Exception
Close the client, which will flush first and then release all the resources- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
setRefreshToken
public void setRefreshToken(String refreshToken)
Set refresh token, this method is for refresh token renewal without requiring to restart client. This method only works when the authorization type is OAuth- Specified by:
setRefreshToken
in interfaceSnowflakeStreamingIngestClient
- Parameters:
refreshToken
- the new refresh token
-
getEncryptionKeysPerTable
public Map<FullyQualifiedTableName,EncryptionKey> getEncryptionKeysPerTable()
-
setStorageManager
public void setStorageManager(net.snowflake.ingest.streaming.internal.IStorageManager storageManager)
-
-