firebase:: storage:: Controller
#include <controller.h>
Controls an ongoing operation, allowing the caller to Pause, Resume or Cancel an ongoing download or upload.
Summary
An instance ofController can be constructed and passed toStorageReference::GetBytes(),StorageReference::GetFile(),StorageReference::PutBytes(), orStorageReference::PutFile() to become associated with it. EachController can only be associated with one operation at a time.
AController is also passed as an argument toListener's callbacks. TheController passed to aStorageReference operation is not the same object passed toListener callbacks (though it refers to the same operation), so there are no restrictions on the lifetime of theController the user creates (but theController passed into aListener callbacks should only be used from within that callback).
This class is currently not thread safe and can only be called on the main thread.
Constructors and Destructors | |
|---|---|
Controller()Default constructor. | |
Controller(constController & other)Copy constructor. | |
Controller(Controller && other)Move constructor. | |
~Controller()Destructor. |
Public functions | |
|---|---|
Cancel() | boolCancels the operation currently in progress. |
GetReference() const | Returns theStorageReference associated with thisController. |
Pause() | boolPauses the operation currently in progress. |
Resume() | boolResumes the operation that is paused. |
bytes_transferred() const | int64_tReturns the number of bytes transferred so far. |
is_paused() const | boolReturns true if the operation is paused. |
is_valid() const | boolReturns true if thisController is valid, false if it is not valid. |
operator=(constController & other) | Copy assignment operator. |
operator=(Controller && other) | Move assignment operator. |
total_byte_count() const | int64_tReturns the total bytes to be transferred. |
Public functions
Cancel
boolCancel()
Cancels the operation currently in progress.
| Details | |
|---|---|
| Returns | True if the operation was successfully canceled, false otherwise. |
Controller
Controller()
Default constructor.
You may construct your ownController to pass into variousStorageReference operations.
Controller
Controller(constController&other)
Copy constructor.
| Details | |||
|---|---|---|---|
| Parameters |
|
Controller
Controller(Controller&&other)
Move constructor.
Moving is an efficient operation forController instances.
| Details | |||
|---|---|---|---|
| Parameters |
|
GetReference
StorageReferenceGetReference()const
Returns theStorageReference associated with thisController.
| Details | |
|---|---|
| Returns | TheStorageReference associated with thisController. |
Pause
boolPause()
Pauses the operation currently in progress.
| Details | |
|---|---|
| Returns | True if the operation was successfully paused, false otherwise. |
Resume
boolResume()
Resumes the operation that is paused.
| Details | |
|---|---|
| Returns | True if the operation was successfully resumed, false otherwise. |
bytes_transferred
int64_tbytes_transferred()const
Returns the number of bytes transferred so far.
| Details | |
|---|---|
| Returns | The number of bytes transferred so far. |
is_paused
boolis_paused()const
Returns true if the operation is paused.
is_valid
boolis_valid()const
Returns true if thisController is valid, false if it is not valid.
An invalidController is one that is not associated with an operation.
| Details | |
|---|---|
| Returns | true if thisController is valid, false if thisController is invalid. |
operator=
Controller&operator=(constController&other)
Copy assignment operator.
| Details | |||
|---|---|---|---|
| Parameters |
| ||
| Returns | Reference to the destinationController. |
operator=
Controller&operator=(Controller&&other)
Move assignment operator.
Moving is an efficient operation forController instances.
| Details | |||
|---|---|---|---|
| Parameters |
| ||
| Returns | Reference to the destinationController. |
total_byte_count
int64_ttotal_byte_count()const
Returns the total bytes to be transferred.
| Details | |
|---|---|
| Returns | The total bytes to be transferred. This will return -1 if the size of the transfer is unknown. |
~Controller
~Controller()
Destructor.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-01-23 UTC.