跳转到正文

artifacts API ​

完整接口目录 · 制品用法 · 工具包下载

模块说明 ​

text
Installation-owned, bounded binary artifacts over managed IPC.

Uploads and retention are explicit and never retried. Retain before submitting
an operation; keep the reference when admission is uncertain. remove is an
explicit request and the Host protects references still needed by operations.

MAX_ARTIFACT_BYTES ​

python
MAX_ARTIFACT_BYTES = 8 * 1024 * 1024

ARTIFACT_CHUNK_BYTES ​

python
ARTIFACT_CHUNK_BYTES = 48 * 1024

ArtifactDescriptor ​

python
class ArtifactDescriptor(TypedDict)

字段(包含继承字段):

ArtifactDescriptor.artifact_id ​

python
artifact_id: str

必填;声明于 artifacts.ArtifactDescriptor。

ArtifactDescriptor.size ​

python
size: int

必填;声明于 artifacts.ArtifactDescriptor。

ArtifactDescriptor.sha256 ​

python
sha256: str

必填;声明于 artifacts.ArtifactDescriptor。

ArtifactDescriptor.received ​

python
received: int

必填;声明于 artifacts.ArtifactDescriptor。

ArtifactDescriptor.complete ​

python
complete: bool

必填;声明于 artifacts.ArtifactDescriptor。

ArtifactUploadError ​

python
class ArtifactUploadError(ProtocolError)

SDK 说明:

text
Upload response unresolved. offset is the last acknowledged byte count.

ArtifactUploadError.__init__ ​

python
def __init__(self, artifact_id, offset, phase)

ArtifactUploadError.artifact_id ​

python
self.artifact_id

公开实例属性,在 __init__ 中设置。

ArtifactUploadError.offset ​

python
self.offset

公开实例属性,在 __init__ 中设置。

ArtifactUploadError.phase ​

python
self.phase

公开实例属性,在 __init__ 中设置。

ArtifactRetentionUncertain ​

python
class ArtifactRetentionUncertain(ProtocolError)

ArtifactRetentionUncertain.__init__ ​

python
def __init__(self, artifact_id, idempotency_key)

ArtifactRetentionUncertain.artifact_id ​

python
self.artifact_id

公开实例属性,在 __init__ 中设置。

ArtifactRetentionUncertain.idempotency_key ​

python
self.idempotency_key

公开实例属性,在 __init__ 中设置。

Artifacts ​

python
class Artifacts

Artifacts.__init__ ​

python
def __init__(self, peer, session)

Artifacts.upload ​

python
async def upload(self, content: bytes, *, timeout=10) -> ArtifactDescriptor

SDK 说明:

text
Upload once in 48 KiB chunks; timeout bounds each IPC request.

Artifacts.upload_file ​

python
async def upload_file(self, path, *, timeout=10) -> ArtifactDescriptor

SDK 说明:

text
Read a local regular file with an 8 MiB bound, then upload it once.

Artifacts.retain ​

python
async def retain(
    self,
    artifact_id: str,
    idempotency_key: str,
    *,
    timeout = 10,
) -> ArtifactDescriptor

SDK 说明:

text
Pin to a caller-chosen operation key before admission; never retry.

Artifacts.read ​

python
async def read(self, artifact_id: str, *, timeout=10) -> bytes

SDK 说明:

text
Read bounded chunks and verify immutable metadata, offsets and SHA-256.

Artifacts.remove ​

python
async def remove(self, artifact_id: str, *, timeout=10)

SDK 说明:

text
Explicit removal; Host may reject a reference retained by an operation.

Artifacts.peer ​

python
self.peer

公开实例属性,在 __init__ 中设置。

Artifacts.session ​

python
self.session

公开实例属性,在 __init__ 中设置。

Neomega · 使用、开发与参考文档