The apply method takes a F[ChannelSftp], but closes more resources than it acquires - it acquires a ChannelSftp, but closes the session as well.
I think closing the session is fine, but we should take a F[Session] then and just manage the channels internally. As it stands now it's impossible to perform concurrent operations on the store, since one channel can handle a single write at a time, and the store only works on one channel. AND if you try to make multiple stores for multiple channels on the client side, the store closes the session.
Maybe make something like:
Internal pool of ChannelSftp
On put acquire a channel from the pool and use it
Since it's blocking IO, making the pool unbounded makes sense.
The SftpStore is a bit clunky at the moment:
The apply method takes a
F[ChannelSftp]
, but closes more resources than it acquires - it acquires aChannelSftp
, but closes the session as well.I think closing the session is fine, but we should take a
F[Session]
then and just manage the channels internally. As it stands now it's impossible to perform concurrent operations on the store, since one channel can handle a single write at a time, and the store only works on one channel. AND if you try to make multiple stores for multiple channels on the client side, the store closes the session.Maybe make something like:
ChannelSftp
put
acquire a channel from the pool and use itSince it's blocking IO, making the pool unbounded makes sense.
Any thoughts on this?