Skip to content
Snippets Groups Projects
Commit b131429b authored by paulavidas's avatar paulavidas Committed by Copybara-Service
Browse files

Change return type of Write from Status to StatusOr<int>.

PiperOrigin-RevId: 266746557
parent 648222d2
No related branches found
No related tags found
No related merge requests found
...@@ -18,8 +18,10 @@ cc_library( ...@@ -18,8 +18,10 @@ cc_library(
cc_library( cc_library(
name = "simple_output_stream", name = "simple_output_stream",
hdrs = ["simple_output_stream.h"], hdrs = ["simple_output_stream.h"],
include_prefix = "tink/",
deps = [ deps = [
"//cc/util:status", "//cc/util:status",
"//cc/util:statusor",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
], ],
) )
...@@ -10,13 +10,13 @@ ...@@ -10,13 +10,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from "tink/python/util/clif.h" import * # Status from "tink/python/util/clif.h" import * # Status, StatusOr
from "tink/python/cc/simple_output_stream.h": from "tink/python/cc/simple_output_stream.h":
namespace `crypto::tink`: namespace `crypto::tink`:
class SimpleOutputStream: class SimpleOutputStream:
@virtual @virtual
def `Write` as write(self, data: bytes) -> Status def `Write` as write(self, data: bytes) -> StatusOr<int>
@virtual @virtual
def `Close` as close(self) -> Status def `Close` as close(self) -> Status
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"
#include "tink/util/status.h" #include "tink/util/status.h"
#include "tink/util/statusor.h"
namespace crypto { namespace crypto {
namespace tink { namespace tink {
...@@ -25,8 +26,9 @@ namespace tink { ...@@ -25,8 +26,9 @@ namespace tink {
// from Python to C++ via CLIF and vice versa. // from Python to C++ via CLIF and vice versa.
class SimpleOutputStream { class SimpleOutputStream {
public: public:
// Writes 'data' to the underlying stream. // Writes 'data' to the underlying stream and returns the number of bytes
virtual util::Status Write(absl::string_view data) = 0; // written, which can be less than the size of 'data'.
virtual util::StatusOr<int> Write(absl::string_view data) = 0;
// Closes the underlying stream. // Closes the underlying stream.
virtual util::Status Close() = 0; virtual util::Status Close() = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment