mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Support payload offsets
Support sending a file or stream payload from a non-zero offset. This allows the clients to resume a transfer. Upper layers should use this feature only when both sides support it. PiperOrigin-RevId: 385137570
This commit is contained in:
committed by
Copybara-Service
parent
a8fe61d846
commit
ed511f962d
@@ -79,6 +79,14 @@ class InternalPayload {
|
||||
// cleanup may be required by the concrete implementation.
|
||||
virtual Exception AttachNextChunk(const ByteArray& chunk) = 0;
|
||||
|
||||
// Skips current stream pointer to the offset.
|
||||
//
|
||||
// Used when this is a resume outgoing transfer, so we want to skip
|
||||
// some data until the offset position.
|
||||
//
|
||||
// @return the offset really skipped
|
||||
virtual ExceptionOr<size_t> SkipToOffset(size_t offset) = 0;
|
||||
|
||||
// Cleans up any resources used by this Payload. Called when we're stopping
|
||||
// early, e.g. after being cancelled or having no more recipients left.
|
||||
virtual void Close() {}
|
||||
|
||||
Reference in New Issue
Block a user