libsshpp v0.1.7
Modern C++17 wrapper for libssh
Loading...
Searching...
No Matches
sshpp::sftp::File Class Reference

A single open SFTP file handle. See docs/design/06 §6.3. More...

#include <file.hpp>

Inheritance diagram for sshpp::sftp::File:
[legend]
Collaboration diagram for sshpp::sftp::File:
[legend]

Public Member Functions

 File ()=default
 
 ~File ()
 
 File (File &&) noexcept
 
Fileoperator= (File &&) noexcept
 
 File (const File &)=delete
 
 operator bool () const noexcept
 
native_sftp_file native_handle () const noexcept
 
const RemotePathpath () const noexcept
 
Result< std::size_t > try_read (MutableByteView)
 
Result< void > try_read_exact (MutableByteView)
 
Result< std::size_t > try_write (ByteView)
 
Result< void > try_write_all (ByteView)
 
Result< std::uint64_t > try_tell () const
 
Result< void > try_seek (std::uint64_t offset)
 
Result< void > try_rewind ()
 
Result< Attributestry_stat () const
 
Result< void > try_truncate (std::uint64_t size)
 
Result< void > try_close ()
 
 ReadAhead (File &file, std::size_t chunk=0, std::size_t depth=0)
 
 ~ReadAhead ()
 
 ReadAhead (const ReadAhead &)=delete
 
 ReadAhead (ReadAhead &&)=delete
 
Result< ByteViewtry_next ()
 
 WriteBehind (File &file, std::size_t chunk=0, std::size_t depth=0)
 
 ~WriteBehind ()
 
 WriteBehind (const WriteBehind &)=delete
 
 WriteBehind (WriteBehind &&)=delete
 
Result< void > try_write (ByteView data)
 
Result< void > try_flush ()
 

Friends

class Sftp
 

Detailed Description

A single open SFTP file handle. See docs/design/06 §6.3.

Keeps up to depth writes in flight; mirror of ReadAhead for the write side.

Keeps up to depth reads in flight so throughput isn't capped at one round trip per chunk. Falls back to a synchronous loop when the linked libssh predates sftp_aio_* (SSHPP_HAS_SFTP_AIO == 0). See docs/design/06 §6.3.

Constructor & Destructor Documentation

◆ File() [1/3]

sshpp::sftp::File::File ( )
default

◆ ~File()

SSHPP_INLINE sshpp::sftp::File::~File ( )

◆ File() [2/3]

SSHPP_INLINE sshpp::sftp::File::File ( File &&  other)
noexcept

◆ File() [3/3]

sshpp::sftp::File::File ( const File )
delete

◆ ~ReadAhead()

sshpp::sftp::File::~ReadAhead ( )

◆ ~WriteBehind()

sshpp::sftp::File::~WriteBehind ( )

Member Function Documentation

◆ operator=()

SSHPP_INLINE File & sshpp::sftp::File::operator= ( File &&  other)
noexcept

◆ operator bool()

sshpp::sftp::File::operator bool ( ) const
inlineexplicitnoexcept

◆ native_handle()

native_sftp_file sshpp::sftp::File::native_handle ( ) const
inlinenoexcept

◆ path()

const RemotePath & sshpp::sftp::File::path ( ) const
inlinenoexcept

◆ try_read()

SSHPP_INLINE Result< std::size_t > sshpp::sftp::File::try_read ( MutableByteView  buf)

◆ try_read_exact()

SSHPP_INLINE Result< void > sshpp::sftp::File::try_read_exact ( MutableByteView  buf)

◆ try_write() [1/2]

SSHPP_INLINE Result< std::size_t > sshpp::sftp::File::try_write ( ByteView  data)

◆ try_write_all()

SSHPP_INLINE Result< void > sshpp::sftp::File::try_write_all ( ByteView  data)

◆ try_tell()

SSHPP_INLINE Result< std::uint64_t > sshpp::sftp::File::try_tell ( ) const

◆ try_seek()

SSHPP_INLINE Result< void > sshpp::sftp::File::try_seek ( std::uint64_t  offset)

◆ try_rewind()

SSHPP_INLINE Result< void > sshpp::sftp::File::try_rewind ( )

◆ try_stat()

SSHPP_INLINE Result< Attributes > sshpp::sftp::File::try_stat ( ) const

◆ try_truncate()

SSHPP_INLINE Result< void > sshpp::sftp::File::try_truncate ( std::uint64_t  size)

◆ try_close()

SSHPP_INLINE Result< void > sshpp::sftp::File::try_close ( )

◆ ReadAhead() [1/3]

sshpp::sftp::File::ReadAhead ( File file,
std::size_t  chunk = 0,
std::size_t  depth = 0 
)
explicit

◆ ReadAhead() [2/3]

sshpp::sftp::File::ReadAhead ( const ReadAhead &  )
delete

◆ ReadAhead() [3/3]

sshpp::sftp::File::ReadAhead ( ReadAhead &&  )
delete

◆ try_next()

Result< ByteView > sshpp::sftp::File::try_next ( )

Returns the next contiguous chunk in file order; empty span == EOF. The returned view is invalidated by the next call to try_next().

◆ WriteBehind() [1/3]

sshpp::sftp::File::WriteBehind ( File file,
std::size_t  chunk = 0,
std::size_t  depth = 0 
)
explicit

◆ WriteBehind() [2/3]

sshpp::sftp::File::WriteBehind ( const WriteBehind &  )
delete

◆ WriteBehind() [3/3]

sshpp::sftp::File::WriteBehind ( WriteBehind &&  )
delete

◆ try_write() [2/2]

Result< void > sshpp::sftp::File::try_write ( ByteView  data)

◆ try_flush()

Result< void > sshpp::sftp::File::try_flush ( )

Waits for all in-flight writes to complete. Also called by the destructor (errors from that implicit call go to Library::set_destructor_error_handler()).

Friends And Related Symbol Documentation

◆ Sftp

friend class Sftp
friend

The documentation for this class was generated from the following files: