mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 16:22:35 +01:00
ircd::fs: Use const_buffer rather than string_view in various returns.
This commit is contained in:
parent
bc79fabfef
commit
bf445492db
5 changed files with 18 additions and 18 deletions
|
@ -16,7 +16,7 @@ namespace ircd::fs
|
||||||
struct read_opts extern const read_opts_default;
|
struct read_opts extern const read_opts_default;
|
||||||
|
|
||||||
// Yields ircd::ctx for read into buffer; returns view of read portion.
|
// Yields ircd::ctx for read into buffer; returns view of read portion.
|
||||||
string_view read(const string_view &path, const mutable_buffer &, const read_opts & = read_opts_default);
|
const_buffer read(const string_view &path, const mutable_buffer &, const read_opts & = read_opts_default);
|
||||||
|
|
||||||
// Yields ircd::ctx for read into allocated string; returns that string
|
// Yields ircd::ctx for read into allocated string; returns that string
|
||||||
std::string read(const string_view &path, const read_opts & = read_opts_default);
|
std::string read(const string_view &path, const read_opts & = read_opts_default);
|
||||||
|
|
|
@ -16,13 +16,13 @@ namespace ircd::fs
|
||||||
struct write_opts extern const write_opts_default;
|
struct write_opts extern const write_opts_default;
|
||||||
|
|
||||||
// Yields ircd::ctx for write from buffer; returns view of written portion
|
// Yields ircd::ctx for write from buffer; returns view of written portion
|
||||||
string_view write(const string_view &path, const const_buffer &, const write_opts & = write_opts_default);
|
const_buffer write(const string_view &path, const const_buffer &, const write_opts & = write_opts_default);
|
||||||
|
|
||||||
// Yields ircd::ctx to overwrite (trunc) file from buffer; returns view of written portion
|
// Yields ircd::ctx to overwrite (trunc) file from buffer; returns view of written portion
|
||||||
string_view overwrite(const string_view &path, const const_buffer &, const write_opts & = write_opts_default);
|
const_buffer overwrite(const string_view &path, const const_buffer &, const write_opts & = write_opts_default);
|
||||||
|
|
||||||
// Yields ircd::ctx to append to file from buffer; returns view of written portion
|
// Yields ircd::ctx to append to file from buffer; returns view of written portion
|
||||||
string_view append(const string_view &path, const const_buffer &, const write_opts & = write_opts_default);
|
const_buffer append(const string_view &path, const const_buffer &, const write_opts & = write_opts_default);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Options for a write operation
|
/// Options for a write operation
|
||||||
|
@ -52,7 +52,7 @@ ircd::fs::write_opts::write_opts(const off_t &offset)
|
||||||
:offset{offset}
|
:offset{offset}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
inline ircd::string_view
|
inline ircd::const_buffer
|
||||||
ircd::fs::overwrite(const string_view &path,
|
ircd::fs::overwrite(const string_view &path,
|
||||||
const const_buffer &buf,
|
const const_buffer &buf,
|
||||||
const write_opts &opts_)
|
const write_opts &opts_)
|
||||||
|
@ -62,7 +62,7 @@ ircd::fs::overwrite(const string_view &path,
|
||||||
return write(path, buf, opts);
|
return write(path, buf, opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ircd::string_view
|
inline ircd::const_buffer
|
||||||
ircd::fs::append(const string_view &path,
|
ircd::fs::append(const string_view &path,
|
||||||
const const_buffer &buf,
|
const const_buffer &buf,
|
||||||
const write_opts &opts_)
|
const write_opts &opts_)
|
||||||
|
|
|
@ -324,7 +324,7 @@ ircd::fs::read__aio(const string_view &path,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ircd::string_view
|
ircd::const_buffer
|
||||||
ircd::fs::read__aio(const string_view &path,
|
ircd::fs::read__aio(const string_view &path,
|
||||||
const mutable_buffer &buf,
|
const mutable_buffer &buf,
|
||||||
const read_opts &opts)
|
const read_opts &opts)
|
||||||
|
@ -357,7 +357,7 @@ ircd::fs::read__aio(const string_view &path,
|
||||||
request()
|
request()
|
||||||
};
|
};
|
||||||
|
|
||||||
const string_view view
|
const const_buffer view
|
||||||
{
|
{
|
||||||
reinterpret_cast<const char *>(data(buf)), bytes
|
reinterpret_cast<const char *>(data(buf)), bytes
|
||||||
};
|
};
|
||||||
|
@ -391,7 +391,7 @@ ircd::fs::aio::request::write::write(const int &fd,
|
||||||
// ircd::fs interface
|
// ircd::fs interface
|
||||||
//
|
//
|
||||||
|
|
||||||
ircd::string_view
|
ircd::const_buffer
|
||||||
ircd::fs::write__aio(const string_view &path,
|
ircd::fs::write__aio(const string_view &path,
|
||||||
const const_buffer &buf,
|
const const_buffer &buf,
|
||||||
const write_opts &opts)
|
const write_opts &opts)
|
||||||
|
@ -432,7 +432,7 @@ ircd::fs::write__aio(const string_view &path,
|
||||||
request()
|
request()
|
||||||
};
|
};
|
||||||
|
|
||||||
const string_view view
|
const const_buffer view
|
||||||
{
|
{
|
||||||
data(buf), bytes
|
data(buf), bytes
|
||||||
};
|
};
|
||||||
|
|
|
@ -74,8 +74,8 @@ struct ircd::fs::aio::request
|
||||||
|
|
||||||
namespace ircd::fs
|
namespace ircd::fs
|
||||||
{
|
{
|
||||||
string_view write__aio(const string_view &path, const const_buffer &, const write_opts &);
|
const_buffer write__aio(const string_view &path, const const_buffer &, const write_opts &);
|
||||||
string_view read__aio(const string_view &path, const mutable_buffer &, const read_opts &);
|
const_buffer read__aio(const string_view &path, const mutable_buffer &, const read_opts &);
|
||||||
std::string read__aio(const string_view &path, const read_opts &);
|
std::string read__aio(const string_view &path, const read_opts &);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
ircd/fs.cc
12
ircd/fs.cc
|
@ -116,7 +116,7 @@ ircd::fs::stdin::readline(const mutable_buffer &buf)
|
||||||
|
|
||||||
namespace ircd::fs
|
namespace ircd::fs
|
||||||
{
|
{
|
||||||
string_view read__std(const string_view &path, const mutable_buffer &, const read_opts &);
|
const_buffer read__std(const string_view &path, const mutable_buffer &, const read_opts &);
|
||||||
std::string read__std(const string_view &path, const read_opts &);
|
std::string read__std(const string_view &path, const read_opts &);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ catch(const std::exception &e)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
ircd::string_view
|
ircd::const_buffer
|
||||||
ircd::fs::read(const string_view &path,
|
ircd::fs::read(const string_view &path,
|
||||||
const mutable_buffer &buf,
|
const mutable_buffer &buf,
|
||||||
const read_opts &opts)
|
const read_opts &opts)
|
||||||
|
@ -184,7 +184,7 @@ ircd::fs::read__std(const string_view &path,
|
||||||
return std::string{b, e};
|
return std::string{b, e};
|
||||||
}
|
}
|
||||||
|
|
||||||
ircd::string_view
|
ircd::const_buffer
|
||||||
ircd::fs::read__std(const string_view &path,
|
ircd::fs::read__std(const string_view &path,
|
||||||
const mutable_buffer &buf,
|
const mutable_buffer &buf,
|
||||||
const read_opts &opts)
|
const read_opts &opts)
|
||||||
|
@ -206,14 +206,14 @@ ircd::fs::read__std(const string_view &path,
|
||||||
|
|
||||||
namespace ircd::fs
|
namespace ircd::fs
|
||||||
{
|
{
|
||||||
string_view write__std(const string_view &path, const const_buffer &, const write_opts &);
|
const_buffer write__std(const string_view &path, const const_buffer &, const write_opts &);
|
||||||
}
|
}
|
||||||
|
|
||||||
ircd::fs::write_opts
|
ircd::fs::write_opts
|
||||||
const ircd::fs::write_opts_default
|
const ircd::fs::write_opts_default
|
||||||
{};
|
{};
|
||||||
|
|
||||||
ircd::string_view
|
ircd::const_buffer
|
||||||
ircd::fs::write(const string_view &path,
|
ircd::fs::write(const string_view &path,
|
||||||
const const_buffer &buf,
|
const const_buffer &buf,
|
||||||
const write_opts &opts)
|
const write_opts &opts)
|
||||||
|
@ -234,7 +234,7 @@ catch(const std::exception &e)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
ircd::string_view
|
ircd::const_buffer
|
||||||
ircd::fs::write__std(const string_view &path,
|
ircd::fs::write__std(const string_view &path,
|
||||||
const const_buffer &buf,
|
const const_buffer &buf,
|
||||||
const write_opts &opts)
|
const write_opts &opts)
|
||||||
|
|
Loading…
Reference in a new issue