File tree 2 files changed +13
-6
lines changed
2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -77,14 +77,21 @@ Bucket::Bucket()
77
77
{
78
78
}
79
79
80
+ std::unique_ptr<XDRInputFileStream>
81
+ Bucket::openStream ()
82
+ {
83
+ releaseAssertOrThrow (!mFilename .empty ());
84
+ auto streamPtr = std::make_unique<XDRInputFileStream>();
85
+ streamPtr->open (mFilename .string ());
86
+ return std::move (streamPtr);
87
+ }
88
+
80
89
XDRInputFileStream&
81
90
Bucket::getIndexStream ()
82
91
{
83
92
if (!mIndexStream )
84
93
{
85
- mIndexStream = std::make_unique<XDRInputFileStream>();
86
- releaseAssertOrThrow (!mFilename .empty ());
87
- mIndexStream ->open (mFilename .string ());
94
+ mIndexStream = openStream ();
88
95
}
89
96
return *mIndexStream ;
90
97
}
@@ -94,9 +101,7 @@ Bucket::getEvictionStream()
94
101
{
95
102
if (!mEvictionStream )
96
103
{
97
- mEvictionStream = std::make_unique<XDRInputFileStream>();
98
- releaseAssertOrThrow (!mFilename .empty ());
99
- mEvictionStream ->open (mFilename .string ());
104
+ mEvictionStream = openStream ();
100
105
}
101
106
return *mEvictionStream ;
102
107
}
Original file line number Diff line number Diff line change @@ -70,6 +70,8 @@ class Bucket : public std::enable_shared_from_this<Bucket>,
70
70
std::optional<BucketEntry>
71
71
getEntryAtOffset (LedgerKey const & k, std::streamoff pos, size_t pageSize);
72
72
73
+ std::unique_ptr<XDRInputFileStream> openStream ();
74
+
73
75
static std::string randomFileName (std::string const & tmpDir,
74
76
std::string ext);
75
77
You can’t perform that action at this time.
0 commit comments