1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-01-30 05:39:12 +02:00

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

This commit is contained in:
David Steele 2017-11-06 12:40:54 -05:00
parent 8d6a08a32b
commit f07d2a3d0d
4 changed files with 27 additions and 3 deletions

View File

@ -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>

View File

@ -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;
}
####################################################################################################################################

View File

@ -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()};

View File

@ -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;
}