Class DataImportServerCommandChannel
java.lang.Object
com.illumon.iris.db.tables.dataimport.logtailer.DataImportServerCommandChannel
- All Implemented Interfaces:
AutoCloseable
Open a socket to a DataImportServer, in preparation for sending commands.
Unlike
LogtailerDestinationManager
, this connection is not tied to a specific table location
and it doesn't have an ongoing job, or thread.
TODO: this needs a maintenance thread (or something similar) that can close the socket after a period of inactivity-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDataImportServerCommandChannel
(com.fishlib.io.logger.Logger log, DataRoutingService.DeferredEndpoint remoteAddress, String disName) Construct a manager to log stream commands.DataImportServerCommandChannel
(com.fishlib.io.logger.Logger log, DataRoutingService.DeferredEndpoint remoteAddress, String disName, TokenFactoryFactory tokenAuthenticationManager) Construct a manager to log stream commands. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected void
Close the SocketChannel, if it is not null.delete
(FullTableLocationKey key, boolean dryRun) Instruct the DataImportServer to delete the specified locations, and wait for confirmation.protected String
Instruct the DataImportServer to rescan the specified location (or all locations if null), and wait for confirmation.Delegate totruncate(FullTableLocationKey, boolean)
with dryRun set to false.truncate
(FullTableLocationKey key, boolean dryRun) Instruct the DataImportServer to truncate the specified location, and wait for confirmation.
-
Field Details
-
remoteEndpoint
-
-
Constructor Details
-
DataImportServerCommandChannel
public DataImportServerCommandChannel(com.fishlib.io.logger.Logger log, DataRoutingService.DeferredEndpoint remoteAddress, String disName) Construct a manager to log stream commands. Uses the default authentication manager.- Parameters:
log
- the log to which errors will be sentremoteAddress
- the address of the remote DataImportServer for this connectiondisName
- the name of the targeted DataImportServer. Useful for logging
-
DataImportServerCommandChannel
public DataImportServerCommandChannel(@NotNull com.fishlib.io.logger.Logger log, @NotNull DataRoutingService.DeferredEndpoint remoteAddress, @NotNull String disName, @NotNull TokenFactoryFactory tokenAuthenticationManager) Construct a manager to log stream commands.- Parameters:
log
- the log to which errors will be sentremoteAddress
- the address of the remote DataImportServer for this connectiondisName
- the name of the targeted DataImportServer. Useful for loggingtokenAuthenticationManager
- a new authentication client manager
-
-
Method Details
-
truncate
public AckTruncateMessage truncate(FullTableLocationKey key) throws IOException, AuthenticationFailure, ChannelException Delegate totruncate(FullTableLocationKey, boolean)
with dryRun set to false. -
truncate
public AckTruncateMessage truncate(FullTableLocationKey key, boolean dryRun) throws IOException, AuthenticationFailure, ChannelException Instruct the DataImportServer to truncate the specified location, and wait for confirmation.- Parameters:
key
- FullTableLocationKey specifying the locations to be truncated; will be AggregateTableLocationKey in most cases.dryRun
- if true, don't really truncate data, just say what would have happened- Returns:
- An AckTruncateMessage containing detailed results of the operation
- Throws:
IOException
- for communication errorsChannelException
- also for communication errorsAuthenticationFailure
- if the truncation failed due to authentication or permission failure
-
delete
public AckTruncateMessage delete(FullTableLocationKey key, boolean dryRun) throws IOException, AuthenticationFailure, ChannelException Instruct the DataImportServer to delete the specified locations, and wait for confirmation. Locations may be deleted only after they have been truncated.- Parameters:
key
- FullTableLocationKey specifying the locations to be deleted; will be AggregateTableLocationKey in most cases.dryRun
- if true, don't really delete data, just say what would have happened- Returns:
- An AckTruncateMessage containing detailed results of the operation
- Throws:
IOException
- for communication errorsChannelException
- also for communication errorsAuthenticationFailure
- if the truncation failed due to authentication or permission failure
-
rescan
public AckRescanMessage rescan(@Nullable String namespace, @Nullable String tableName) throws IOException, ChannelException Instruct the DataImportServer to rescan the specified location (or all locations if null), and wait for confirmation.- Parameters:
namespace
- (optional) namespace of the table to rescan. If specified, tableName is required.tableName
- (optional) name of the table to rescan. If specified, namespace is required.- Returns:
- An AckRescanMessage containing detailed results of the operation
- Throws:
IOException
- for communication errorsChannelException
- also for communication errorsAuthException
- if the truncation failed due to authentication or permission failure
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
IOException
-
closeSocketChannel
Close the SocketChannel, if it is not null.- Throws:
IOException
- maybe thrown by socketChannel.close()
-
getRemoteEndpointName
-