@NotThreadSafe public final class GrpcDataWriter extends Object implements DataWriter
DataWriter.Factory
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancels an operation.
|
int |
chunkSize() |
void |
close() |
static GrpcDataWriter |
create(FileSystemContext context,
WorkerNetAddress address,
long id,
long length,
RequestType type,
OutStreamOptions options) |
void |
flush()
Flushes all the pending chunks.
|
Optional<String> |
getUfsContentHash() |
long |
pos() |
void |
writeChunk(io.netty.buffer.ByteBuf buf)
Writes a chunk.
|
public static GrpcDataWriter create(FileSystemContext context, WorkerNetAddress address, long id, long length, RequestType type, OutStreamOptions options) throws IOException
context
- the file system contextaddress
- the data server addressid
- the block or UFS IDlength
- the length of the block or file to write, set to Long.MAX_VALUE if unknowntype
- type of the write requestoptions
- the options of the output streamGrpcDataWriter
IOException
public long pos()
pos
in interface DataWriter
public Optional<String> getUfsContentHash()
getUfsContentHash
in interface DataWriter
public void writeChunk(io.netty.buffer.ByteBuf buf) throws IOException
DataWriter
writeChunk
in interface DataWriter
buf
- the chunkIOException
public void cancel()
Cancelable
cancel
in interface Cancelable
public void flush() throws IOException
DataWriter
flush
in interface DataWriter
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public int chunkSize()
chunkSize
in interface DataWriter
Copyright © 2023. All Rights Reserved.