pgbackrest.git / summary / log / commit / refs

commit    f07d2a3d0dbfa7ea510e41a9ea66265b46db1158
Author:   David Steele <david@crunchydata.com>
Date:     Mon Nov 06 17:40:54 2017 +0000

    Add eof to S3 file driver (required for encryption support).


doc/xml/release.xml | 4 ++++ lib/pgBackRest/Common/Http/Client.pm | 10 +++++++++- lib/pgBackRest/Common/Io/Filter.pm | 1 + lib/pgBackRest/Common/Io/Handle.pm | 15 +++++++++++++-- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/doc/xml/release.xml b/doc/xml/release.xml index 4baf4e6b5..9fec22c3c 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -30,6 +30,10 @@ <release-item> <p>Convert configuration definitions from auto-generated functions to auto-generated data structures.</p> </release-item> + + <release-item> + <p>Add <id>eof</id> to S3 file driver (required for encryption support).</p> + </release-item> </release-refactor-list> </release-core-list> diff --git a/lib/pgBackRest/Common/Http/Client.pm b/lib/pgBackRest/Common/Http/Client.pm index 6900418d2..01d09c986 100644 --- a/lib/pgBackRest/Common/Http/Client.pm +++ b/lib/pgBackRest/Common/Http/Client.pm @@ -266,7 +266,15 @@ sub read $iRequestSize = $iRequestSize < $self->{iContentRemaining} ? $iRequestSize : $self->{iContentRemaining}; $self->{iContentRemaining} -= $iRequestSize; - return $self->SUPER::read($rtBuffer, $iRequestSize, true); + my $iActualSize = $self->SUPER::read($rtBuffer, $iRequestSize, true); + + # Set eof if there is nothing left to read + if ($self->{iContentRemaining} == 0) + { + $self->SUPER::eofSet(true); + } + + return $iActualSize; } #################################################################################################################################### diff --git a/lib/pgBackRest/Common/Io/Filter.pm b/lib/pgBackRest/Common/Io/Filter.pm index 94cf35695..af55de836 100644 --- a/lib/pgBackRest/Common/Io/Filter.pm +++ b/lib/pgBackRest/Common/Io/Filter.pm @@ -51,6 +51,7 @@ sub bufferMax {shift->{oParent}->bufferMax()}; sub className {shift->{oParent}->className()}; sub close {shift->{oParent}->close()}; sub eof {shift->{oParent}->eof()}; +sub eofSet {shift->{oParent}->eofSet(@_)}; sub error {shift->{oParent}->error(@_)}; sub id {shift->{oParent}->id()}; sub handleRead {shift->{oParent}->handleRead()}; diff --git a/lib/pgBackRest/Common/Io/Handle.pm b/lib/pgBackRest/Common/Io/Handle.pm index 91344626f..b6ce367e8 100644 --- a/lib/pgBackRest/Common/Io/Handle.pm +++ b/lib/pgBackRest/Common/Io/Handle.pm @@ -56,7 +56,7 @@ sub new $self->{lSize} = 0; # Initialize EOF to false - $self->{bEOF} = false; + $self->eofSet(false); # Return from function and log return values if any return logDebugReturn @@ -77,6 +77,17 @@ sub eof return shift->{bEOF}; } +#################################################################################################################################### +# eofSet - set eof +#################################################################################################################################### +sub eofSet +{ + my $self = shift; + my $bEOF = shift; + + $self->{bEOF} = $bEOF; +} + #################################################################################################################################### # read - read data from handle #################################################################################################################################### @@ -108,7 +119,7 @@ sub read $self->{lSize} += $iActualSize; # Update EOF - $self->{bEOF} = $iActualSize == 0 ? true : false; + $self->eofSet($iActualSize == 0 ? true : false); return $iActualSize; } [parent: 8d6a08a32b12]