Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] Change channel expiration behaviour #310

Open
TripleSpeeder opened this issue Jul 13, 2022 · 2 comments
Open

[DRAFT] Change channel expiration behaviour #310

TripleSpeeder opened this issue Jul 13, 2022 · 2 comments

Comments

@TripleSpeeder
Copy link
Collaborator

TripleSpeeder commented Jul 13, 2022

Channel service needs to handle these scenarios:

(Live) Group/Star connection (shared directly via qrcode or chat)

This is a multi-use channel - During lifetime of the channel multiple people can join it and connect

  • short-living channel (minimum TTL 15 - 30 minutes)
  • dynamic TTL extension not required, but okay

(Async) 1:1 connection (shared directly via qrcode or async via email/messenger etc)

This is a single-use channel - As soon as 2 people have connected, the channel is not needed anymore.

  • long-living channel (minimum TTL hours or days)
  • dynamic TTL extension not required, but okay
  • channel can be closed before minimum TTL is reached when it has been used

(Async) Social recovery (shared directly via qrcode or async via email/messenger etc)

This is a multi-use channel - During lifetime of the channel multiple people can join it and upload recovery info

  • long-living channel (minimum TTL hours or days)
  • dynamic TTL, depending on amount of data to transfer
  • TTL should be extended with every upload

(Live) Add/sync device (shared directly via QRCode)

  • Short-living channel. Minimum TTL can be low, as only one person is interacting with the channel
  • dynamic TTL, depending on amount of data to transfer
  • TTL should be extended with every upload

serverside handling of channel TTL:

  • Client can provide a minimum TTL value when creating (uploading first file) a channel

    • Service should set default TTL of 15 minutes if client does not provide minimum TTL
  • Channel service should keep a channel open at least until minimum TTL is reached, even if it is not used at all

  • Channel service should extend channel TTL whenever a new file is uploaded:

    • if remaining TTL is less than 10 minutes, new TTL of "now + 10 minutes" is set
    • If remaining TTL is > 10 minutes nothing changes

Client information

Since channel TTL gets changed dynamically, client does not know if a channel is expired on the server. To fix this, the service needs to be changed:

  • It should respond with a 404 error when client requests listing of an unknown/expired channel (Current behaviour: Service returns HTTP 200 with empty array of channel entries)
  • It should set a custom HTTP header in the response containing the current TTL of the channel (both when listing and retrieving entries)

This way the client can locally close/leave expired channels and stay informed about the current TTL of a channel.

@adamstallard
Copy link
Member

Thanks @TripleSpeeder for creating a thorough spec that covers all the current important use cases. It seems correct to me. I would like to also hear @abramsymons thoughts.

@TripleSpeeder
Copy link
Collaborator Author

About TTL extension when a file is uploaded:
Channel service should not need to have different behaviour depending on type of channel. So even if not required in all usecases it should always be okay to extend the channel lifetime with each upload.

@siftal siftal mentioned this issue Aug 11, 2022
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants