@NotThreadSafe public final class BlockWriteHandler extends Object
AbstractWriteHandler
.Modifier and Type | Field and Description |
---|---|
static long |
FILE_BUFFER_SIZE |
protected AuthenticatedUserInfo |
mUserInfo |
Modifier and Type | Method and Description |
---|---|
protected void |
cancelRequest(BlockWriteRequestContext context)
Cancels this write.
|
protected void |
cleanupRequest(BlockWriteRequestContext context)
Cleans up this write.
|
protected void |
completeRequest(BlockWriteRequestContext context)
Completes this write.
|
protected BlockWriteRequestContext |
createRequestContext(WriteRequest msg)
Creates a new request context.
|
protected void |
flushRequest(BlockWriteRequestContext context)
Flushes the buffered data.
|
String |
getLocation() |
protected String |
getLocationInternal(BlockWriteRequestContext context) |
protected void |
handleCommand(WriteRequestCommand command,
T context)
Handles a command in the write request.
|
void |
onCancel()
Handles request cancellation event.
|
void |
onCompleted()
Handles request complete event.
|
void |
onError(Throwable cause)
Handles errors from the request.
|
void |
write(WriteRequest writeRequest)
Handles write request.
|
protected void |
writeBuf(BlockWriteRequestContext context,
io.grpc.stub.StreamObserver<WriteResponse> observer,
DataBuffer buf,
long pos)
Writes the buffer.
|
void |
writeDataMessage(WriteRequest request,
DataBuffer buffer)
Handles write request with data message.
|
public static final long FILE_BUFFER_SIZE
protected AuthenticatedUserInfo mUserInfo
protected BlockWriteRequestContext createRequestContext(WriteRequest msg) throws Exception
msg
- the block write requestException
protected void completeRequest(BlockWriteRequestContext context) throws Exception
context
- context of the request to completeException
protected void cancelRequest(BlockWriteRequestContext context) throws Exception
context
- context of the request to completeException
protected void cleanupRequest(BlockWriteRequestContext context) throws Exception
context
- context of the request to completeException
protected void flushRequest(BlockWriteRequestContext context) throws Exception
context
- context of the request to completeException
protected void writeBuf(BlockWriteRequestContext context, io.grpc.stub.StreamObserver<WriteResponse> observer, DataBuffer buf, long pos) throws Exception
context
- context of the request to completeobserver
- the response observerbuf
- the bufferpos
- the posException
protected String getLocationInternal(BlockWriteRequestContext context)
context
- the context of the requestpublic void write(WriteRequest writeRequest)
writeRequest
- the request from the clientpublic void writeDataMessage(WriteRequest request, DataBuffer buffer)
request
- the request from the clientbuffer
- the data associated with the requestpublic void onCompleted()
public void onCancel()
public void onError(Throwable cause)
cause
- the exceptionpublic String getLocation()
protected void handleCommand(WriteRequestCommand command, T context) throws Exception
command
- the command to be handledException
Copyright © 2023. All Rights Reserved.