Optimization 5 - Add exists(String file) method to FileBackend
Some resource implementations use FileBackend to upload data and they need to check if the file exists before hand. On the S3FileBackend implementation existence checking in these resources is implemented by calling openInput and then immediately closing it. The problem is that S3 SDK reads the entire file before closing it. That can get expensive when you're downloading a large file just to check that it exists.
Optimization 5 - Add
exists(String file)
method toFileBackend
Some resource implementations use
FileBackend
to upload data and they need to check if the file exists before hand. On theS3FileBackend
implementation existence checking in these resources is implemented by callingopenInput
and then immediately closing it. The problem is that S3 SDK reads the entire file before closing it. That can get expensive when you're downloading a large file just to check that it exists.https://github.com/perfectsense/gyro/blob/feature/performance/core/src/main/java/gyro/core/FileBackend.java#L54-L64
FileBackend implementations will need to be updated to use this. See the
S3FileBackend
implementation below.https://github.com/perfectsense/gyro-aws-provider/blob/feature/performance/src/main/java/gyro/aws/S3FileBackend.java#L128-L137