feat(contracts): create services/contracts workspace package and commit stubs
- Create services/contracts workspace package with module magnetflix. - Reconfigure buf.gen.yaml to output stubs once into services/contracts/src. - Remove stubs and docs/api_spec.md from .gitignore and track in Git. - Add public seam tests in tests/test_contracts.py. Closes #1
This commit is contained in:
1 parent
9b16758eec
commit
9edc5e20cf
11 files changed
+1025
-16
No files matched your search
+1
-4
@@ -15,9 +15,6 @@ dist/
|
||||
data/
|
||||
config/
|
||||
|
||||
# Generated docs and proto stubs in services (if re-generated on build)
|
||||
docs/api_spec.md
|
||||
# Local environment
|
||||
.envrc
|
||||
.direnv/
|
||||
services/bff/src/bff/magnetflix/v1/
|
||||
services/worker/src/worker/magnetflix/v1/
|
||||
+4
-12
@@ -3,21 +3,13 @@ inputs:
|
||||
- directory: proto
|
||||
plugins:
|
||||
- remote: buf.build/protocolbuffers/python
|
||||
out: services/worker/src/worker
|
||||
out: services/contracts/src
|
||||
- remote: buf.build/grpc/python
|
||||
out: services/worker/src/worker
|
||||
out: services/contracts/src
|
||||
- remote: buf.build/community/nipunn1313-mypy
|
||||
out: services/worker/src/worker
|
||||
out: services/contracts/src
|
||||
- remote: buf.build/community/nipunn1313-mypy-grpc
|
||||
out: services/worker/src/worker
|
||||
- remote: buf.build/protocolbuffers/python
|
||||
out: services/bff/src/bff
|
||||
- remote: buf.build/grpc/python
|
||||
out: services/bff/src/bff
|
||||
- remote: buf.build/community/nipunn1313-mypy
|
||||
out: services/bff/src/bff
|
||||
- remote: buf.build/community/nipunn1313-mypy-grpc
|
||||
out: services/bff/src/bff
|
||||
out: services/contracts/src
|
||||
- remote: buf.build/community/pseudomuto-doc
|
||||
out: docs
|
||||
opt:
|
||||
|
||||
@@ -0,0 +1,243 @@
|
||||
# Protocol Documentation
|
||||
<a name="top"></a>
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [magnetflix/v1/pipeline.proto](#magnetflix_v1_pipeline-proto)
|
||||
- [GetJobRequest](#magnetflix-v1-GetJobRequest)
|
||||
- [GetJobResponse](#magnetflix-v1-GetJobResponse)
|
||||
- [JobStatus](#magnetflix-v1-JobStatus)
|
||||
- [ListJobsRequest](#magnetflix-v1-ListJobsRequest)
|
||||
- [ListJobsResponse](#magnetflix-v1-ListJobsResponse)
|
||||
- [StreamJobStatusRequest](#magnetflix-v1-StreamJobStatusRequest)
|
||||
- [StreamJobStatusResponse](#magnetflix-v1-StreamJobStatusResponse)
|
||||
- [SubmitDownloadRequest](#magnetflix-v1-SubmitDownloadRequest)
|
||||
- [SubmitDownloadResponse](#magnetflix-v1-SubmitDownloadResponse)
|
||||
|
||||
- [JobState](#magnetflix-v1-JobState)
|
||||
|
||||
- [PipelineService](#magnetflix-v1-PipelineService)
|
||||
|
||||
- [Scalar Value Types](#scalar-value-types)
|
||||
|
||||
|
||||
|
||||
<a name="magnetflix_v1_pipeline-proto"></a>
|
||||
<p align="right"><a href="#top">Top</a></p>
|
||||
|
||||
## magnetflix/v1/pipeline.proto
|
||||
|
||||
|
||||
|
||||
<a name="magnetflix-v1-GetJobRequest"></a>
|
||||
|
||||
### GetJobRequest
|
||||
Request to fetch a specific job by ID.
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| job_id | [string](#string) | | Unique job identifier. |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="magnetflix-v1-GetJobResponse"></a>
|
||||
|
||||
### GetJobResponse
|
||||
Response containing the status of the requested job.
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| job | [JobStatus](#magnetflix-v1-JobStatus) | | The retrieved job details. |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="magnetflix-v1-JobStatus"></a>
|
||||
|
||||
### JobStatus
|
||||
Full status information for a download job.
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| job_id | [string](#string) | | Unique job ID. |
|
||||
| imdb_id | [string](#string) | | IMDb ID. |
|
||||
| title | [string](#string) | | Resolved movie title from TMDB (if available). |
|
||||
| year | [int32](#int32) | | Resolved release year from TMDB (if available). |
|
||||
| requested_by | [string](#string) | | User who requested the download. |
|
||||
| state | [JobState](#magnetflix-v1-JobState) | | Current state in the pipeline. |
|
||||
| progress_pct | [float](#float) | | Download progress percentage (0.0 to 100.0). |
|
||||
| download_rate_bytes | [int64](#int64) | | Download speed in bytes per second. |
|
||||
| error_message | [string](#string) | | Detailed error message if the job failed. |
|
||||
| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | Timestamp when the job was enqueued. |
|
||||
| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | Timestamp when the job status or progress was last updated. |
|
||||
| completed_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | Timestamp when terminal processing finished (COMPLETED or FAILED). |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="magnetflix-v1-ListJobsRequest"></a>
|
||||
|
||||
### ListJobsRequest
|
||||
Request to list jobs with pagination and state filtering.
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| page_size | [int32](#int32) | | Maximum number of jobs to return per page (default: 20, max: 100). |
|
||||
| page_token | [string](#string) | | Page token received from a previous ListJobsResponse next_page_token. |
|
||||
| state_filter | [JobState](#magnetflix-v1-JobState) | | Optional filter by job state. |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="magnetflix-v1-ListJobsResponse"></a>
|
||||
|
||||
### ListJobsResponse
|
||||
Paginated response containing a list of download jobs.
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| jobs | [JobStatus](#magnetflix-v1-JobStatus) | repeated | List of matching jobs for the current page. |
|
||||
| next_page_token | [string](#string) | | Token to retrieve the next page of results, or empty if no more results. |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="magnetflix-v1-StreamJobStatusRequest"></a>
|
||||
|
||||
### StreamJobStatusRequest
|
||||
Request to stream job updates.
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| job_id | [string](#string) | | Optional job ID to filter updates for a single job; if empty, streams all active jobs. |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="magnetflix-v1-StreamJobStatusResponse"></a>
|
||||
|
||||
### StreamJobStatusResponse
|
||||
Real-time job status event stream frame.
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| job | [JobStatus](#magnetflix-v1-JobStatus) | | Current job status update. |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="magnetflix-v1-SubmitDownloadRequest"></a>
|
||||
|
||||
### SubmitDownloadRequest
|
||||
Request to submit a new movie download.
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| magnet_uri | [string](#string) | | Magnet URI of the torrent to fetch. |
|
||||
| imdb_id | [string](#string) | | IMDb ID of the movie (e.g., "tt1375666"). |
|
||||
| requested_by | [string](#string) | | Username of the user requesting the download (from Authelia Remote-User). |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="magnetflix-v1-SubmitDownloadResponse"></a>
|
||||
|
||||
### SubmitDownloadResponse
|
||||
Response acknowledging the job submission.
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| job_id | [string](#string) | | Unique identifier for the created job. |
|
||||
| message | [string](#string) | | Human-readable message. |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="magnetflix-v1-JobState"></a>
|
||||
|
||||
### JobState
|
||||
State enumeration of a download job lifecycle.
|
||||
|
||||
| Name | Number | Description |
|
||||
| ---- | ------ | ----------- |
|
||||
| JOB_STATE_UNSPECIFIED | 0 | |
|
||||
| JOB_STATE_QUEUED | 1 | |
|
||||
| JOB_STATE_DOWNLOADING | 2 | |
|
||||
| JOB_STATE_SCANNING | 3 | |
|
||||
| JOB_STATE_VERIFYING_METADATA | 4 | |
|
||||
| JOB_STATE_ORGANIZING | 5 | |
|
||||
| JOB_STATE_COMPLETED | 6 | |
|
||||
| JOB_STATE_FAILED | 7 | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="magnetflix-v1-PipelineService"></a>
|
||||
|
||||
### PipelineService
|
||||
PipelineService coordinates movie download jobs, safety scans, and library relocation.
|
||||
|
||||
| Method Name | Request Type | Response Type | Description |
|
||||
| ----------- | ------------ | ------------- | ------------|
|
||||
| SubmitDownload | [SubmitDownloadRequest](#magnetflix-v1-SubmitDownloadRequest) | [SubmitDownloadResponse](#magnetflix-v1-SubmitDownloadResponse) | SubmitDownload enqueues a new movie download job. Rejects duplicate submissions if an active job for the same IMDb ID exists or if already in library. |
|
||||
| GetJob | [GetJobRequest](#magnetflix-v1-GetJobRequest) | [GetJobResponse](#magnetflix-v1-GetJobResponse) | GetJob retrieves the current status and metadata of a specific job. |
|
||||
| StreamJobStatus | [StreamJobStatusRequest](#magnetflix-v1-StreamJobStatusRequest) | [StreamJobStatusResponse](#magnetflix-v1-StreamJobStatusResponse) stream | StreamJobStatus streams real-time status updates. Semantics: Emits an immediate snapshot of matching active jobs upon connection, followed by subsequent state and progress change events. |
|
||||
| ListJobs | [ListJobsRequest](#magnetflix-v1-ListJobsRequest) | [ListJobsResponse](#magnetflix-v1-ListJobsResponse) | ListJobs returns a paginated list of download jobs. |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Scalar Value Types
|
||||
|
||||
| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby |
|
||||
| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- |
|
||||
| <a name="double" /> double | | double | double | float | float64 | double | float | Float |
|
||||
| <a name="float" /> float | | float | float | float | float32 | float | float | Float |
|
||||
| <a name="int32" /> int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
|
||||
| <a name="int64" /> int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum |
|
||||
| <a name="uint32" /> uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) |
|
||||
| <a name="uint64" /> uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) |
|
||||
| <a name="sint32" /> sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
|
||||
| <a name="sint64" /> sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum |
|
||||
| <a name="fixed32" /> fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) |
|
||||
| <a name="fixed64" /> fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum |
|
||||
| <a name="sfixed32" /> sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
|
||||
| <a name="sfixed64" /> sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum |
|
||||
| <a name="bool" /> bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass |
|
||||
| <a name="string" /> string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) |
|
||||
| <a name="bytes" /> bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) |
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# MagNetFlix Contracts
|
||||
|
||||
Shared Protobuf and gRPC stubs generated from `proto/` definitions for the MagNetFlix workspace.
|
||||
@@ -0,0 +1,18 @@
|
||||
[project]
|
||||
name = "magnetflix-contracts"
|
||||
version = "0.1.0"
|
||||
description = "Protobuf and gRPC schemas and stubs for MagNetFlix"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
dependencies = [
|
||||
"grpcio>=1.83.1",
|
||||
"protobuf>=7.36.2",
|
||||
]
|
||||
|
||||
[build-system]
|
||||
requires = ["uv_build>=0.12.5,<0.13.0"]
|
||||
build-backend = "uv_build"
|
||||
|
||||
[tool.uv.build-backend]
|
||||
module-name = "magnetflix"
|
||||
module-root = "src"
|
||||
@@ -0,0 +1,3 @@
|
||||
"""Shared Protobuf and gRPC schemas and stubs for MagNetFlix."""
|
||||
|
||||
__version__ = "0.1.0"
|
||||
@@ -0,0 +1,57 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# NO CHECKED-IN PROTOBUF GENCODE
|
||||
# source: magnetflix/v1/pipeline.proto
|
||||
# Protobuf Python Version: 7.36.2
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import runtime_version as _runtime_version
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
_runtime_version.ValidateProtobufRuntimeVersion(
|
||||
_runtime_version.Domain.PUBLIC,
|
||||
7,
|
||||
36,
|
||||
2,
|
||||
'',
|
||||
'magnetflix/v1/pipeline.proto'
|
||||
)
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1cmagnetflix/v1/pipeline.proto\x12\rmagnetflix.v1\x1a\x1fgoogle/protobuf/timestamp.proto\"r\n\x15SubmitDownloadRequest\x12\x1d\n\nmagnet_uri\x18\x01 \x01(\tR\tmagnetUri\x12\x17\n\x07imdb_id\x18\x02 \x01(\tR\x06imdbId\x12!\n\x0crequested_by\x18\x03 \x01(\tR\x0brequestedBy\"I\n\x16SubmitDownloadResponse\x12\x15\n\x06job_id\x18\x01 \x01(\tR\x05jobId\x12\x18\n\x07message\x18\x02 \x01(\tR\x07message\"&\n\rGetJobRequest\x12\x15\n\x06job_id\x18\x01 \x01(\tR\x05jobId\"<\n\x0eGetJobResponse\x12*\n\x03job\x18\x01 \x01(\x0b\x32\x18.magnetflix.v1.JobStatusR\x03job\"/\n\x16StreamJobStatusRequest\x12\x15\n\x06job_id\x18\x01 \x01(\tR\x05jobId\"E\n\x17StreamJobStatusResponse\x12*\n\x03job\x18\x01 \x01(\x0b\x32\x18.magnetflix.v1.JobStatusR\x03job\"\x89\x01\n\x0fListJobsRequest\x12\x1b\n\tpage_size\x18\x01 \x01(\x05R\x08pageSize\x12\x1d\n\npage_token\x18\x02 \x01(\tR\tpageToken\x12:\n\x0cstate_filter\x18\x03 \x01(\x0e\x32\x17.magnetflix.v1.JobStateR\x0bstateFilter\"\xe4\x03\n\tJobStatus\x12\x15\n\x06job_id\x18\x01 \x01(\tR\x05jobId\x12\x17\n\x07imdb_id\x18\x02 \x01(\tR\x06imdbId\x12\x14\n\x05title\x18\x03 \x01(\tR\x05title\x12\x12\n\x04year\x18\x04 \x01(\x05R\x04year\x12!\n\x0crequested_by\x18\x05 \x01(\tR\x0brequestedBy\x12-\n\x05state\x18\x06 \x01(\x0e\x32\x17.magnetflix.v1.JobStateR\x05state\x12!\n\x0cprogress_pct\x18\x07 \x01(\x02R\x0bprogressPct\x12.\n\x13\x64ownload_rate_bytes\x18\x08 \x01(\x03R\x11\x64ownloadRateBytes\x12#\n\rerror_message\x18\t \x01(\tR\x0c\x65rrorMessage\x12\x39\n\ncreated_at\x18\n \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tcreatedAt\x12\x39\n\nupdated_at\x18\x0b \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tupdatedAt\x12=\n\x0c\x63ompleted_at\x18\x0c \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x0b\x63ompletedAt\"h\n\x10ListJobsResponse\x12,\n\x04jobs\x18\x01 \x03(\x0b\x32\x18.magnetflix.v1.JobStatusR\x04jobs\x12&\n\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken*\xd9\x01\n\x08JobState\x12\x19\n\x15JOB_STATE_UNSPECIFIED\x10\x00\x12\x14\n\x10JOB_STATE_QUEUED\x10\x01\x12\x19\n\x15JOB_STATE_DOWNLOADING\x10\x02\x12\x16\n\x12JOB_STATE_SCANNING\x10\x03\x12 \n\x1cJOB_STATE_VERIFYING_METADATA\x10\x04\x12\x18\n\x14JOB_STATE_ORGANIZING\x10\x05\x12\x17\n\x13JOB_STATE_COMPLETED\x10\x06\x12\x14\n\x10JOB_STATE_FAILED\x10\x07\x32\xe8\x02\n\x0fPipelineService\x12]\n\x0eSubmitDownload\x12$.magnetflix.v1.SubmitDownloadRequest\x1a%.magnetflix.v1.SubmitDownloadResponse\x12\x45\n\x06GetJob\x12\x1c.magnetflix.v1.GetJobRequest\x1a\x1d.magnetflix.v1.GetJobResponse\x12\x62\n\x0fStreamJobStatus\x12%.magnetflix.v1.StreamJobStatusRequest\x1a&.magnetflix.v1.StreamJobStatusResponse0\x01\x12K\n\x08ListJobs\x12\x1e.magnetflix.v1.ListJobsRequest\x1a\x1f.magnetflix.v1.ListJobsResponseb\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'magnetflix.v1.pipeline_pb2', _globals)
|
||||
if not _descriptor._USE_C_DESCRIPTORS:
|
||||
DESCRIPTOR._loaded_options = None
|
||||
_globals['_JOBSTATE']._serialized_start=1227
|
||||
_globals['_JOBSTATE']._serialized_end=1444
|
||||
_globals['_SUBMITDOWNLOADREQUEST']._serialized_start=80
|
||||
_globals['_SUBMITDOWNLOADREQUEST']._serialized_end=194
|
||||
_globals['_SUBMITDOWNLOADRESPONSE']._serialized_start=196
|
||||
_globals['_SUBMITDOWNLOADRESPONSE']._serialized_end=269
|
||||
_globals['_GETJOBREQUEST']._serialized_start=271
|
||||
_globals['_GETJOBREQUEST']._serialized_end=309
|
||||
_globals['_GETJOBRESPONSE']._serialized_start=311
|
||||
_globals['_GETJOBRESPONSE']._serialized_end=371
|
||||
_globals['_STREAMJOBSTATUSREQUEST']._serialized_start=373
|
||||
_globals['_STREAMJOBSTATUSREQUEST']._serialized_end=420
|
||||
_globals['_STREAMJOBSTATUSRESPONSE']._serialized_start=422
|
||||
_globals['_STREAMJOBSTATUSRESPONSE']._serialized_end=491
|
||||
_globals['_LISTJOBSREQUEST']._serialized_start=494
|
||||
_globals['_LISTJOBSREQUEST']._serialized_end=631
|
||||
_globals['_JOBSTATUS']._serialized_start=634
|
||||
_globals['_JOBSTATUS']._serialized_end=1118
|
||||
_globals['_LISTJOBSRESPONSE']._serialized_start=1120
|
||||
_globals['_LISTJOBSRESPONSE']._serialized_end=1224
|
||||
_globals['_PIPELINESERVICE']._serialized_start=1447
|
||||
_globals['_PIPELINESERVICE']._serialized_end=1807
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
@@ -0,0 +1,327 @@
|
||||
"""
|
||||
@generated by mypy-protobuf. Do not edit manually!
|
||||
isort:skip_file
|
||||
"""
|
||||
|
||||
from collections import abc as _abc
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import message as _message
|
||||
from google.protobuf import timestamp_pb2 as _timestamp_pb2
|
||||
from google.protobuf.internal import containers as _containers
|
||||
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
|
||||
import builtins as _builtins
|
||||
import sys
|
||||
import typing as _typing
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from typing import TypeAlias as _TypeAlias, Never as _Never
|
||||
else:
|
||||
from typing_extensions import TypeAlias as _TypeAlias, Never as _Never
|
||||
|
||||
DESCRIPTOR: _descriptor.FileDescriptor
|
||||
|
||||
class _JobState:
|
||||
ValueType = _typing.NewType("ValueType", _builtins.int)
|
||||
V: _TypeAlias = ValueType # noqa: Y015
|
||||
|
||||
class _JobStateEnumTypeWrapper(_enum_type_wrapper._EnumTypeWrapper[_JobState.ValueType], _builtins.type):
|
||||
DESCRIPTOR: _descriptor.EnumDescriptor
|
||||
JOB_STATE_UNSPECIFIED: _JobState.ValueType # 0
|
||||
JOB_STATE_QUEUED: _JobState.ValueType # 1
|
||||
JOB_STATE_DOWNLOADING: _JobState.ValueType # 2
|
||||
JOB_STATE_SCANNING: _JobState.ValueType # 3
|
||||
JOB_STATE_VERIFYING_METADATA: _JobState.ValueType # 4
|
||||
JOB_STATE_ORGANIZING: _JobState.ValueType # 5
|
||||
JOB_STATE_COMPLETED: _JobState.ValueType # 6
|
||||
JOB_STATE_FAILED: _JobState.ValueType # 7
|
||||
|
||||
class JobState(_JobState, metaclass=_JobStateEnumTypeWrapper):
|
||||
"""State enumeration of a download job lifecycle."""
|
||||
|
||||
JOB_STATE_UNSPECIFIED: JobState.ValueType # 0
|
||||
JOB_STATE_QUEUED: JobState.ValueType # 1
|
||||
JOB_STATE_DOWNLOADING: JobState.ValueType # 2
|
||||
JOB_STATE_SCANNING: JobState.ValueType # 3
|
||||
JOB_STATE_VERIFYING_METADATA: JobState.ValueType # 4
|
||||
JOB_STATE_ORGANIZING: JobState.ValueType # 5
|
||||
JOB_STATE_COMPLETED: JobState.ValueType # 6
|
||||
JOB_STATE_FAILED: JobState.ValueType # 7
|
||||
Global___JobState: _TypeAlias = JobState # noqa: Y015
|
||||
|
||||
@_typing.final
|
||||
class SubmitDownloadRequest(_message.Message):
|
||||
"""Request to submit a new movie download."""
|
||||
|
||||
DESCRIPTOR: _descriptor.Descriptor
|
||||
|
||||
MAGNET_URI_FIELD_NUMBER: _builtins.int
|
||||
IMDB_ID_FIELD_NUMBER: _builtins.int
|
||||
REQUESTED_BY_FIELD_NUMBER: _builtins.int
|
||||
magnet_uri: _builtins.str
|
||||
"""Magnet URI of the torrent to fetch."""
|
||||
imdb_id: _builtins.str
|
||||
"""IMDb ID of the movie (e.g., "tt1375666")."""
|
||||
requested_by: _builtins.str
|
||||
"""Username of the user requesting the download (from Authelia Remote-User)."""
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
magnet_uri: _builtins.str = ...,
|
||||
imdb_id: _builtins.str = ...,
|
||||
requested_by: _builtins.str = ...,
|
||||
) -> None: ...
|
||||
_HasFieldArgType: _TypeAlias = _Never # noqa: Y015
|
||||
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
|
||||
_ClearFieldArgType: _TypeAlias = _typing.Literal["imdb_id", b"imdb_id", "magnet_uri", b"magnet_uri", "requested_by", b"requested_by"] # noqa: Y015
|
||||
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
|
||||
def WhichOneof(self, oneof_group: _Never) -> None: ...
|
||||
|
||||
Global___SubmitDownloadRequest: _TypeAlias = SubmitDownloadRequest # noqa: Y015
|
||||
|
||||
@_typing.final
|
||||
class SubmitDownloadResponse(_message.Message):
|
||||
"""Response acknowledging the job submission."""
|
||||
|
||||
DESCRIPTOR: _descriptor.Descriptor
|
||||
|
||||
JOB_ID_FIELD_NUMBER: _builtins.int
|
||||
MESSAGE_FIELD_NUMBER: _builtins.int
|
||||
job_id: _builtins.str
|
||||
"""Unique identifier for the created job."""
|
||||
message: _builtins.str
|
||||
"""Human-readable message."""
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
job_id: _builtins.str = ...,
|
||||
message: _builtins.str = ...,
|
||||
) -> None: ...
|
||||
_HasFieldArgType: _TypeAlias = _Never # noqa: Y015
|
||||
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
|
||||
_ClearFieldArgType: _TypeAlias = _typing.Literal["job_id", b"job_id", "message", b"message"] # noqa: Y015
|
||||
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
|
||||
def WhichOneof(self, oneof_group: _Never) -> None: ...
|
||||
|
||||
Global___SubmitDownloadResponse: _TypeAlias = SubmitDownloadResponse # noqa: Y015
|
||||
|
||||
@_typing.final
|
||||
class GetJobRequest(_message.Message):
|
||||
"""Request to fetch a specific job by ID."""
|
||||
|
||||
DESCRIPTOR: _descriptor.Descriptor
|
||||
|
||||
JOB_ID_FIELD_NUMBER: _builtins.int
|
||||
job_id: _builtins.str
|
||||
"""Unique job identifier."""
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
job_id: _builtins.str = ...,
|
||||
) -> None: ...
|
||||
_HasFieldArgType: _TypeAlias = _Never # noqa: Y015
|
||||
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
|
||||
_ClearFieldArgType: _TypeAlias = _typing.Literal["job_id", b"job_id"] # noqa: Y015
|
||||
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
|
||||
def WhichOneof(self, oneof_group: _Never) -> None: ...
|
||||
|
||||
Global___GetJobRequest: _TypeAlias = GetJobRequest # noqa: Y015
|
||||
|
||||
@_typing.final
|
||||
class GetJobResponse(_message.Message):
|
||||
"""Response containing the status of the requested job."""
|
||||
|
||||
DESCRIPTOR: _descriptor.Descriptor
|
||||
|
||||
JOB_FIELD_NUMBER: _builtins.int
|
||||
@_builtins.property
|
||||
def job(self) -> Global___JobStatus:
|
||||
"""The retrieved job details."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
job: Global___JobStatus | None = ...,
|
||||
) -> None: ...
|
||||
_HasFieldArgType: _TypeAlias = _typing.Literal["job", b"job"] # noqa: Y015
|
||||
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
|
||||
_ClearFieldArgType: _TypeAlias = _typing.Literal["job", b"job"] # noqa: Y015
|
||||
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
|
||||
def WhichOneof(self, oneof_group: _Never) -> None: ...
|
||||
|
||||
Global___GetJobResponse: _TypeAlias = GetJobResponse # noqa: Y015
|
||||
|
||||
@_typing.final
|
||||
class StreamJobStatusRequest(_message.Message):
|
||||
"""Request to stream job updates."""
|
||||
|
||||
DESCRIPTOR: _descriptor.Descriptor
|
||||
|
||||
JOB_ID_FIELD_NUMBER: _builtins.int
|
||||
job_id: _builtins.str
|
||||
"""Optional job ID to filter updates for a single job; if empty, streams all active jobs."""
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
job_id: _builtins.str = ...,
|
||||
) -> None: ...
|
||||
_HasFieldArgType: _TypeAlias = _Never # noqa: Y015
|
||||
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
|
||||
_ClearFieldArgType: _TypeAlias = _typing.Literal["job_id", b"job_id"] # noqa: Y015
|
||||
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
|
||||
def WhichOneof(self, oneof_group: _Never) -> None: ...
|
||||
|
||||
Global___StreamJobStatusRequest: _TypeAlias = StreamJobStatusRequest # noqa: Y015
|
||||
|
||||
@_typing.final
|
||||
class StreamJobStatusResponse(_message.Message):
|
||||
"""Real-time job status event stream frame."""
|
||||
|
||||
DESCRIPTOR: _descriptor.Descriptor
|
||||
|
||||
JOB_FIELD_NUMBER: _builtins.int
|
||||
@_builtins.property
|
||||
def job(self) -> Global___JobStatus:
|
||||
"""Current job status update."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
job: Global___JobStatus | None = ...,
|
||||
) -> None: ...
|
||||
_HasFieldArgType: _TypeAlias = _typing.Literal["job", b"job"] # noqa: Y015
|
||||
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
|
||||
_ClearFieldArgType: _TypeAlias = _typing.Literal["job", b"job"] # noqa: Y015
|
||||
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
|
||||
def WhichOneof(self, oneof_group: _Never) -> None: ...
|
||||
|
||||
Global___StreamJobStatusResponse: _TypeAlias = StreamJobStatusResponse # noqa: Y015
|
||||
|
||||
@_typing.final
|
||||
class ListJobsRequest(_message.Message):
|
||||
"""Request to list jobs with pagination and state filtering."""
|
||||
|
||||
DESCRIPTOR: _descriptor.Descriptor
|
||||
|
||||
PAGE_SIZE_FIELD_NUMBER: _builtins.int
|
||||
PAGE_TOKEN_FIELD_NUMBER: _builtins.int
|
||||
STATE_FILTER_FIELD_NUMBER: _builtins.int
|
||||
page_size: _builtins.int
|
||||
"""Maximum number of jobs to return per page (default: 20, max: 100)."""
|
||||
page_token: _builtins.str
|
||||
"""Page token received from a previous ListJobsResponse next_page_token."""
|
||||
state_filter: Global___JobState.ValueType
|
||||
"""Optional filter by job state."""
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
page_size: _builtins.int = ...,
|
||||
page_token: _builtins.str = ...,
|
||||
state_filter: Global___JobState.ValueType = ...,
|
||||
) -> None: ...
|
||||
_HasFieldArgType: _TypeAlias = _Never # noqa: Y015
|
||||
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
|
||||
_ClearFieldArgType: _TypeAlias = _typing.Literal["page_size", b"page_size", "page_token", b"page_token", "state_filter", b"state_filter"] # noqa: Y015
|
||||
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
|
||||
def WhichOneof(self, oneof_group: _Never) -> None: ...
|
||||
|
||||
Global___ListJobsRequest: _TypeAlias = ListJobsRequest # noqa: Y015
|
||||
|
||||
@_typing.final
|
||||
class JobStatus(_message.Message):
|
||||
"""Full status information for a download job."""
|
||||
|
||||
DESCRIPTOR: _descriptor.Descriptor
|
||||
|
||||
JOB_ID_FIELD_NUMBER: _builtins.int
|
||||
IMDB_ID_FIELD_NUMBER: _builtins.int
|
||||
TITLE_FIELD_NUMBER: _builtins.int
|
||||
YEAR_FIELD_NUMBER: _builtins.int
|
||||
REQUESTED_BY_FIELD_NUMBER: _builtins.int
|
||||
STATE_FIELD_NUMBER: _builtins.int
|
||||
PROGRESS_PCT_FIELD_NUMBER: _builtins.int
|
||||
DOWNLOAD_RATE_BYTES_FIELD_NUMBER: _builtins.int
|
||||
ERROR_MESSAGE_FIELD_NUMBER: _builtins.int
|
||||
CREATED_AT_FIELD_NUMBER: _builtins.int
|
||||
UPDATED_AT_FIELD_NUMBER: _builtins.int
|
||||
COMPLETED_AT_FIELD_NUMBER: _builtins.int
|
||||
job_id: _builtins.str
|
||||
"""Unique job ID."""
|
||||
imdb_id: _builtins.str
|
||||
"""IMDb ID."""
|
||||
title: _builtins.str
|
||||
"""Resolved movie title from TMDB (if available)."""
|
||||
year: _builtins.int
|
||||
"""Resolved release year from TMDB (if available)."""
|
||||
requested_by: _builtins.str
|
||||
"""User who requested the download."""
|
||||
state: Global___JobState.ValueType
|
||||
"""Current state in the pipeline."""
|
||||
progress_pct: _builtins.float
|
||||
"""Download progress percentage (0.0 to 100.0)."""
|
||||
download_rate_bytes: _builtins.int
|
||||
"""Download speed in bytes per second."""
|
||||
error_message: _builtins.str
|
||||
"""Detailed error message if the job failed."""
|
||||
@_builtins.property
|
||||
def created_at(self) -> _timestamp_pb2.Timestamp:
|
||||
"""Timestamp when the job was enqueued."""
|
||||
|
||||
@_builtins.property
|
||||
def updated_at(self) -> _timestamp_pb2.Timestamp:
|
||||
"""Timestamp when the job status or progress was last updated."""
|
||||
|
||||
@_builtins.property
|
||||
def completed_at(self) -> _timestamp_pb2.Timestamp:
|
||||
"""Timestamp when terminal processing finished (COMPLETED or FAILED)."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
job_id: _builtins.str = ...,
|
||||
imdb_id: _builtins.str = ...,
|
||||
title: _builtins.str = ...,
|
||||
year: _builtins.int = ...,
|
||||
requested_by: _builtins.str = ...,
|
||||
state: Global___JobState.ValueType = ...,
|
||||
progress_pct: _builtins.float = ...,
|
||||
download_rate_bytes: _builtins.int = ...,
|
||||
error_message: _builtins.str = ...,
|
||||
created_at: _timestamp_pb2.Timestamp | None = ...,
|
||||
updated_at: _timestamp_pb2.Timestamp | None = ...,
|
||||
completed_at: _timestamp_pb2.Timestamp | None = ...,
|
||||
) -> None: ...
|
||||
_HasFieldArgType: _TypeAlias = _typing.Literal["completed_at", b"completed_at", "created_at", b"created_at", "updated_at", b"updated_at"] # noqa: Y015
|
||||
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
|
||||
_ClearFieldArgType: _TypeAlias = _typing.Literal["completed_at", b"completed_at", "created_at", b"created_at", "download_rate_bytes", b"download_rate_bytes", "error_message", b"error_message", "imdb_id", b"imdb_id", "job_id", b"job_id", "progress_pct", b"progress_pct", "requested_by", b"requested_by", "state", b"state", "title", b"title", "updated_at", b"updated_at", "year", b"year"] # noqa: Y015
|
||||
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
|
||||
def WhichOneof(self, oneof_group: _Never) -> None: ...
|
||||
|
||||
Global___JobStatus: _TypeAlias = JobStatus # noqa: Y015
|
||||
|
||||
@_typing.final
|
||||
class ListJobsResponse(_message.Message):
|
||||
"""Paginated response containing a list of download jobs."""
|
||||
|
||||
DESCRIPTOR: _descriptor.Descriptor
|
||||
|
||||
JOBS_FIELD_NUMBER: _builtins.int
|
||||
NEXT_PAGE_TOKEN_FIELD_NUMBER: _builtins.int
|
||||
next_page_token: _builtins.str
|
||||
"""Token to retrieve the next page of results, or empty if no more results."""
|
||||
@_builtins.property
|
||||
def jobs(self) -> _containers.RepeatedCompositeFieldContainer[Global___JobStatus]:
|
||||
"""List of matching jobs for the current page."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
jobs: _abc.Iterable[Global___JobStatus] | None = ...,
|
||||
next_page_token: _builtins.str = ...,
|
||||
) -> None: ...
|
||||
_HasFieldArgType: _TypeAlias = _Never # noqa: Y015
|
||||
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
|
||||
_ClearFieldArgType: _TypeAlias = _typing.Literal["jobs", b"jobs", "next_page_token", b"next_page_token"] # noqa: Y015
|
||||
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
|
||||
def WhichOneof(self, oneof_group: _Never) -> None: ...
|
||||
|
||||
Global___ListJobsResponse: _TypeAlias = ListJobsResponse # noqa: Y015
|
||||
@@ -0,0 +1,216 @@
|
||||
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
||||
"""Client and server classes corresponding to protobuf-defined services."""
|
||||
import grpc
|
||||
|
||||
from magnetflix.v1 import pipeline_pb2 as magnetflix_dot_v1_dot_pipeline__pb2
|
||||
|
||||
|
||||
class PipelineServiceStub:
|
||||
"""PipelineService coordinates movie download jobs, safety scans, and library relocation.
|
||||
"""
|
||||
|
||||
def __init__(self, channel):
|
||||
"""Constructor.
|
||||
|
||||
Args:
|
||||
channel: A grpc.Channel.
|
||||
"""
|
||||
self.SubmitDownload = channel.unary_unary(
|
||||
'/magnetflix.v1.PipelineService/SubmitDownload',
|
||||
request_serializer=magnetflix_dot_v1_dot_pipeline__pb2.SubmitDownloadRequest.SerializeToString,
|
||||
response_deserializer=magnetflix_dot_v1_dot_pipeline__pb2.SubmitDownloadResponse.FromString,
|
||||
_registered_method=True)
|
||||
self.GetJob = channel.unary_unary(
|
||||
'/magnetflix.v1.PipelineService/GetJob',
|
||||
request_serializer=magnetflix_dot_v1_dot_pipeline__pb2.GetJobRequest.SerializeToString,
|
||||
response_deserializer=magnetflix_dot_v1_dot_pipeline__pb2.GetJobResponse.FromString,
|
||||
_registered_method=True)
|
||||
self.StreamJobStatus = channel.unary_stream(
|
||||
'/magnetflix.v1.PipelineService/StreamJobStatus',
|
||||
request_serializer=magnetflix_dot_v1_dot_pipeline__pb2.StreamJobStatusRequest.SerializeToString,
|
||||
response_deserializer=magnetflix_dot_v1_dot_pipeline__pb2.StreamJobStatusResponse.FromString,
|
||||
_registered_method=True)
|
||||
self.ListJobs = channel.unary_unary(
|
||||
'/magnetflix.v1.PipelineService/ListJobs',
|
||||
request_serializer=magnetflix_dot_v1_dot_pipeline__pb2.ListJobsRequest.SerializeToString,
|
||||
response_deserializer=magnetflix_dot_v1_dot_pipeline__pb2.ListJobsResponse.FromString,
|
||||
_registered_method=True)
|
||||
|
||||
|
||||
class PipelineServiceServicer:
|
||||
"""PipelineService coordinates movie download jobs, safety scans, and library relocation.
|
||||
"""
|
||||
|
||||
def SubmitDownload(self, request, context):
|
||||
"""SubmitDownload enqueues a new movie download job.
|
||||
Rejects duplicate submissions if an active job for the same IMDb ID exists or if already in library.
|
||||
"""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def GetJob(self, request, context):
|
||||
"""GetJob retrieves the current status and metadata of a specific job.
|
||||
"""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def StreamJobStatus(self, request, context):
|
||||
"""StreamJobStatus streams real-time status updates.
|
||||
Semantics: Emits an immediate snapshot of matching active jobs upon connection,
|
||||
followed by subsequent state and progress change events.
|
||||
"""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def ListJobs(self, request, context):
|
||||
"""ListJobs returns a paginated list of download jobs.
|
||||
"""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
|
||||
def add_PipelineServiceServicer_to_server(servicer, server):
|
||||
rpc_method_handlers = {
|
||||
'SubmitDownload': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SubmitDownload,
|
||||
request_deserializer=magnetflix_dot_v1_dot_pipeline__pb2.SubmitDownloadRequest.FromString,
|
||||
response_serializer=magnetflix_dot_v1_dot_pipeline__pb2.SubmitDownloadResponse.SerializeToString,
|
||||
),
|
||||
'GetJob': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.GetJob,
|
||||
request_deserializer=magnetflix_dot_v1_dot_pipeline__pb2.GetJobRequest.FromString,
|
||||
response_serializer=magnetflix_dot_v1_dot_pipeline__pb2.GetJobResponse.SerializeToString,
|
||||
),
|
||||
'StreamJobStatus': grpc.unary_stream_rpc_method_handler(
|
||||
servicer.StreamJobStatus,
|
||||
request_deserializer=magnetflix_dot_v1_dot_pipeline__pb2.StreamJobStatusRequest.FromString,
|
||||
response_serializer=magnetflix_dot_v1_dot_pipeline__pb2.StreamJobStatusResponse.SerializeToString,
|
||||
),
|
||||
'ListJobs': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.ListJobs,
|
||||
request_deserializer=magnetflix_dot_v1_dot_pipeline__pb2.ListJobsRequest.FromString,
|
||||
response_serializer=magnetflix_dot_v1_dot_pipeline__pb2.ListJobsResponse.SerializeToString,
|
||||
),
|
||||
}
|
||||
generic_handler = grpc.method_handlers_generic_handler(
|
||||
'magnetflix.v1.PipelineService', rpc_method_handlers)
|
||||
server.add_generic_rpc_handlers((generic_handler,))
|
||||
server.add_registered_method_handlers('magnetflix.v1.PipelineService', rpc_method_handlers)
|
||||
|
||||
|
||||
# This class is part of an EXPERIMENTAL API.
|
||||
class PipelineService:
|
||||
"""PipelineService coordinates movie download jobs, safety scans, and library relocation.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def SubmitDownload(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/magnetflix.v1.PipelineService/SubmitDownload',
|
||||
magnetflix_dot_v1_dot_pipeline__pb2.SubmitDownloadRequest.SerializeToString,
|
||||
magnetflix_dot_v1_dot_pipeline__pb2.SubmitDownloadResponse.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def GetJob(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/magnetflix.v1.PipelineService/GetJob',
|
||||
magnetflix_dot_v1_dot_pipeline__pb2.GetJobRequest.SerializeToString,
|
||||
magnetflix_dot_v1_dot_pipeline__pb2.GetJobResponse.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def StreamJobStatus(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_stream(
|
||||
request,
|
||||
target,
|
||||
'/magnetflix.v1.PipelineService/StreamJobStatus',
|
||||
magnetflix_dot_v1_dot_pipeline__pb2.StreamJobStatusRequest.SerializeToString,
|
||||
magnetflix_dot_v1_dot_pipeline__pb2.StreamJobStatusResponse.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def ListJobs(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/magnetflix.v1.PipelineService/ListJobs',
|
||||
magnetflix_dot_v1_dot_pipeline__pb2.ListJobsRequest.SerializeToString,
|
||||
magnetflix_dot_v1_dot_pipeline__pb2.ListJobsResponse.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
@@ -0,0 +1,109 @@
|
||||
"""
|
||||
@generated by mypy-protobuf. Do not edit manually!
|
||||
isort:skip_file
|
||||
"""
|
||||
|
||||
from collections import abc as _abc
|
||||
from grpc import aio as _aio
|
||||
from magnetflix.v1 import pipeline_pb2 as _pipeline_pb2
|
||||
import abc as _abc_1
|
||||
import grpc as _grpc
|
||||
import sys
|
||||
import typing as _typing
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from typing import Self as _Self
|
||||
else:
|
||||
from typing_extensions import Self as _Self
|
||||
|
||||
_T = _typing.TypeVar("_T")
|
||||
|
||||
class _MaybeAsyncIterator(_abc.AsyncIterator[_T], _abc.Iterator[_T], metaclass=_abc_1.ABCMeta): ...
|
||||
|
||||
class _ServicerContext(_grpc.ServicerContext, _aio.ServicerContext): # type: ignore[misc, type-arg]
|
||||
...
|
||||
|
||||
GRPC_GENERATED_VERSION: str
|
||||
GRPC_VERSION: str
|
||||
|
||||
class PipelineServiceStub:
|
||||
"""PipelineService coordinates movie download jobs, safety scans, and library relocation."""
|
||||
|
||||
@_typing.overload
|
||||
def __new__(cls, channel: _grpc.Channel) -> _Self: ...
|
||||
@_typing.overload
|
||||
def __new__(cls, channel: _aio.Channel) -> PipelineServiceAsyncStub: ...
|
||||
SubmitDownload: _grpc.UnaryUnaryMultiCallable[_pipeline_pb2.SubmitDownloadRequest, _pipeline_pb2.SubmitDownloadResponse]
|
||||
"""SubmitDownload enqueues a new movie download job.
|
||||
Rejects duplicate submissions if an active job for the same IMDb ID exists or if already in library.
|
||||
"""
|
||||
GetJob: _grpc.UnaryUnaryMultiCallable[_pipeline_pb2.GetJobRequest, _pipeline_pb2.GetJobResponse]
|
||||
"""GetJob retrieves the current status and metadata of a specific job."""
|
||||
StreamJobStatus: _grpc.UnaryStreamMultiCallable[_pipeline_pb2.StreamJobStatusRequest, _pipeline_pb2.StreamJobStatusResponse]
|
||||
"""StreamJobStatus streams real-time status updates.
|
||||
Semantics: Emits an immediate snapshot of matching active jobs upon connection,
|
||||
followed by subsequent state and progress change events.
|
||||
"""
|
||||
ListJobs: _grpc.UnaryUnaryMultiCallable[_pipeline_pb2.ListJobsRequest, _pipeline_pb2.ListJobsResponse]
|
||||
"""ListJobs returns a paginated list of download jobs."""
|
||||
|
||||
@_typing.type_check_only
|
||||
class PipelineServiceAsyncStub(PipelineServiceStub):
|
||||
"""PipelineService coordinates movie download jobs, safety scans, and library relocation."""
|
||||
|
||||
def __init__(self, channel: _aio.Channel) -> None: ...
|
||||
SubmitDownload: _aio.UnaryUnaryMultiCallable[_pipeline_pb2.SubmitDownloadRequest, _pipeline_pb2.SubmitDownloadResponse] # type: ignore[assignment]
|
||||
"""SubmitDownload enqueues a new movie download job.
|
||||
Rejects duplicate submissions if an active job for the same IMDb ID exists or if already in library.
|
||||
"""
|
||||
GetJob: _aio.UnaryUnaryMultiCallable[_pipeline_pb2.GetJobRequest, _pipeline_pb2.GetJobResponse] # type: ignore[assignment]
|
||||
"""GetJob retrieves the current status and metadata of a specific job."""
|
||||
StreamJobStatus: _aio.UnaryStreamMultiCallable[_pipeline_pb2.StreamJobStatusRequest, _pipeline_pb2.StreamJobStatusResponse] # type: ignore[assignment]
|
||||
"""StreamJobStatus streams real-time status updates.
|
||||
Semantics: Emits an immediate snapshot of matching active jobs upon connection,
|
||||
followed by subsequent state and progress change events.
|
||||
"""
|
||||
ListJobs: _aio.UnaryUnaryMultiCallable[_pipeline_pb2.ListJobsRequest, _pipeline_pb2.ListJobsResponse] # type: ignore[assignment]
|
||||
"""ListJobs returns a paginated list of download jobs."""
|
||||
|
||||
class PipelineServiceServicer(metaclass=_abc_1.ABCMeta):
|
||||
"""PipelineService coordinates movie download jobs, safety scans, and library relocation."""
|
||||
|
||||
@_abc_1.abstractmethod
|
||||
def SubmitDownload(
|
||||
self,
|
||||
request: _pipeline_pb2.SubmitDownloadRequest,
|
||||
context: _ServicerContext,
|
||||
) -> _typing.Union[_pipeline_pb2.SubmitDownloadResponse, _abc.Awaitable[_pipeline_pb2.SubmitDownloadResponse]]:
|
||||
"""SubmitDownload enqueues a new movie download job.
|
||||
Rejects duplicate submissions if an active job for the same IMDb ID exists or if already in library.
|
||||
"""
|
||||
|
||||
@_abc_1.abstractmethod
|
||||
def GetJob(
|
||||
self,
|
||||
request: _pipeline_pb2.GetJobRequest,
|
||||
context: _ServicerContext,
|
||||
) -> _typing.Union[_pipeline_pb2.GetJobResponse, _abc.Awaitable[_pipeline_pb2.GetJobResponse]]:
|
||||
"""GetJob retrieves the current status and metadata of a specific job."""
|
||||
|
||||
@_abc_1.abstractmethod
|
||||
def StreamJobStatus(
|
||||
self,
|
||||
request: _pipeline_pb2.StreamJobStatusRequest,
|
||||
context: _ServicerContext,
|
||||
) -> _typing.Union[_abc.Iterator[_pipeline_pb2.StreamJobStatusResponse], _abc.AsyncIterator[_pipeline_pb2.StreamJobStatusResponse]]:
|
||||
"""StreamJobStatus streams real-time status updates.
|
||||
Semantics: Emits an immediate snapshot of matching active jobs upon connection,
|
||||
followed by subsequent state and progress change events.
|
||||
"""
|
||||
|
||||
@_abc_1.abstractmethod
|
||||
def ListJobs(
|
||||
self,
|
||||
request: _pipeline_pb2.ListJobsRequest,
|
||||
context: _ServicerContext,
|
||||
) -> _typing.Union[_pipeline_pb2.ListJobsResponse, _abc.Awaitable[_pipeline_pb2.ListJobsResponse]]:
|
||||
"""ListJobs returns a paginated list of download jobs."""
|
||||
|
||||
def add_PipelineServiceServicer_to_server(servicer: PipelineServiceServicer, server: _typing.Union[_grpc.Server, _aio.Server]) -> None: ...
|
||||
@@ -0,0 +1,44 @@
|
||||
"""Unit and contract seam tests for generated Protobuf and gRPC stubs."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
def test_protobuf_and_grpc_stubs_importable():
|
||||
"""Verify that both pipeline_pb2 and pipeline_pb2_grpc import cleanly."""
|
||||
from magnetflix.v1 import pipeline_pb2, pipeline_pb2_grpc
|
||||
|
||||
assert pipeline_pb2.JOB_STATE_QUEUED == 1
|
||||
assert pipeline_pb2.JOB_STATE_DOWNLOADING == 2
|
||||
assert hasattr(pipeline_pb2_grpc, "PipelineServiceServicer")
|
||||
assert hasattr(pipeline_pb2_grpc, "PipelineServiceStub")
|
||||
|
||||
|
||||
def test_proto_job_status_creation():
|
||||
"""Verify that JobStatus protobuf message instantiates and serializes."""
|
||||
from google.protobuf.timestamp_pb2 import Timestamp
|
||||
from magnetflix.v1 import pipeline_pb2
|
||||
|
||||
ts = Timestamp()
|
||||
ts.GetCurrentTime()
|
||||
|
||||
status = pipeline_pb2.JobStatus(
|
||||
job_id="test-job-123",
|
||||
imdb_id="tt1375666",
|
||||
title="Inception",
|
||||
year=2010,
|
||||
requested_by="alice",
|
||||
state=pipeline_pb2.JOB_STATE_QUEUED,
|
||||
progress_pct=0.0,
|
||||
download_rate_bytes=0,
|
||||
error_message="",
|
||||
created_at=ts,
|
||||
)
|
||||
|
||||
assert status.job_id == "test-job-123"
|
||||
assert status.title == "Inception"
|
||||
serialized = status.SerializeToString()
|
||||
assert len(serialized) > 0
|
||||
|
||||
deserialized = pipeline_pb2.JobStatus()
|
||||
deserialized.ParseFromString(serialized)
|
||||
assert deserialized.imdb_id == "tt1375666"
|
||||
Reference in new issue
Block a user