syntax = "proto3";

service TorrentStore {
  // Pushes torrent to the store
  rpc Push (PushRequest) returns (PushReply) {}

  // Pulls torrent from the store
  rpc Pull (PullRequest) returns (PullReply) {}

  // Touch torrent in the store
  rpc Touch (TouchRequest) returns (TouchReply) {}
}

// The push response message containing info hash of the pushed torrent file
message PushReply {
  string infoHash = 1;
}

// The push request message containing the torrent and expire duration is seconds
message PushRequest {
  bytes torrent = 1;
  int32 expire  = 2 [deprecated=true];
}

// The pull request message containing the infoHash
message PullRequest {
  string infoHash = 1;
}

// The pull response message containing the torrent
message PullReply {
  bytes torrent = 1;
}

// The check request message containing the infoHash
message CheckRequest {
  string infoHash = 1;
}

// The check response message containing existance flag
message CheckReply {
  bool exists = 1;
}

// The touch response message
message TouchReply {
}

// The touch request message containing the torrent and expire duration is seconds
message TouchRequest {
  string infoHash = 1;
  int32 expire    = 2 [deprecated=true];
}