rename old torrent module

This commit is contained in:
royalcat 2025-01-08 00:51:28 +03:00
parent c496c0269a
commit 10c3f126f0
42 changed files with 1910 additions and 694 deletions

View file

@ -0,0 +1,18 @@
type TorrentDaemonMutation {
validateTorrent(filter: TorrentFilter!): Boolean! @resolver
setTorrentPriority(
infohash: String!
file: String
priority: TorrentPriority!
): Boolean! @resolver
cleanup(files: Boolean, dryRun: Boolean!): CleanupResponse! @resolver
}
type CleanupResponse {
count: Int!
list: [String!]!
}
type DownloadTorrentResponse {
taskID: String!
}

View file

@ -0,0 +1,29 @@
type TorrentDaemonQuery {
torrents(filter: TorrentsFilter): [Torrent!]! @resolver
clientStats: TorrentClientStats! @resolver
statsHistory(since: DateTime!, infohash: String): [TorrentStats!]! @resolver
}
input TorrentsFilter {
infohash: StringFilter
name: StringFilter
bytesCompleted: IntFilter
bytesMissing: IntFilter
peersCount: IntFilter
priority: TorrentPriorityFilter
}
input TorrentPriorityFilter @oneOf {
eq: TorrentPriority
gt: TorrentPriority
lt: TorrentPriority
gte: TorrentPriority
lte: TorrentPriority
in: [TorrentPriority!]
}
input TorrentFilter @oneOf {
everything: Boolean
infohash: String
# pathGlob: String!
}

View file

@ -0,0 +1,21 @@
directive @oneOf on INPUT_OBJECT | FIELD_DEFINITION
directive @resolver on INPUT_FIELD_DEFINITION | FIELD_DEFINITION
directive @stream on FIELD_DEFINITION
scalar DateTime
scalar Upload
scalar UInt
type Schema {
query: Query
mutation: Mutation
}
type Query {
torrentDaemon: TorrentDaemonQuery @resolver
}
type Mutation {
torrentDaemon: TorrentDaemonMutation @resolver
}

View file

@ -0,0 +1,62 @@
type Torrent {
name: String! @resolver
infohash: String!
bytesCompleted: Int!
torrentFilePath: String!
bytesMissing: Int!
priority: TorrentPriority!
files: [TorrentFile!]! @resolver
excludedFiles: [TorrentFile!]! @resolver
peers: [TorrentPeer!]! @resolver
}
type TorrentFile {
filename: String!
size: Int!
bytesCompleted: Int!
priority: TorrentPriority! @resolver
}
type TorrentPeer {
ip: String!
downloadRate: Float!
discovery: String!
port: Int!
clientName: String!
}
enum TorrentPriority {
NONE
NORMAL
HIGH
READAHEAD
NOW
}
type TorrentClientStats {
bytesWritten: Int!
bytesWrittenData: Int!
bytesRead: Int!
bytesReadData: Int!
bytesReadUsefulData: Int!
bytesReadUsefulIntendedData: Int!
chunksWritten: Int!
chunksRead: Int!
chunksReadUseful: Int!
chunksReadWasted: Int!
metadataChunksRead: Int!
piecesDirtiedGood: Int!
piecesDirtiedBad: Int!
}
type TorrentStats {
timestamp: DateTime!
downloadedBytes: UInt!
uploadedBytes: UInt!
totalPeers: UInt!
activePeers: UInt!
connectedSeeders: UInt!
}