binarystore: Add std::optional for optional config options
The `maxSizeBytes` was using 0 size by default instead of skipping it.
Letting `config.maxSizeBytes` be std::optional allow us to have more
control to see if the 0 value is expected or nullopt.
Change-Id: I128216825609909c489cbd5471b324d88d3aa25b
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/include/sys_file_impl.hpp b/include/sys_file_impl.hpp
index c74c965..fa6f5ec 100644
--- a/include/sys_file_impl.hpp
+++ b/include/sys_file_impl.hpp
@@ -6,6 +6,7 @@
#include <fcntl.h>
#include <unistd.h>
+#include <optional>
#include <string>
namespace binstore
@@ -21,7 +22,8 @@
* actually reads underlying file at 'offset'
* @param sys Syscall operation interface
*/
- explicit SysFileImpl(const std::string& path, size_t offset = 0,
+ explicit SysFileImpl(const std::string& path,
+ std::optional<size_t> offset = std::nullopt,
const internal::Sys* sys = &internal::sys_impl);
~SysFileImpl();
SysFileImpl() = delete;