grpcserver

package
v2.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2026 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// APIVersion 是服务器公开的稳定 gRPC API 版本 / APIVersion is the stable gRPC API version exposed by the server
	APIVersion = "meido.serialization.v1"
	// DefaultMaxInlineBytes 是单个请求或响应默认允许内联的最大字节数 / DefaultMaxInlineBytes is the default maximum number of bytes inlined in one request or response
	DefaultMaxInlineBytes = 3 << 20
	// MaxInlineBytes 是 gRPC 消息安全允许的最大内联字节数 / MaxInlineBytes is the maximum inline byte count permitted by the gRPC message safety bound
	MaxInlineBytes = 3 << 20
	// DefaultChunkBytes 是 blob 下载使用的默认分块字节数 / DefaultChunkBytes is the default chunk size in bytes used for blob downloads
	DefaultChunkBytes = 256 << 10
	// MaxChunkBytes 是单个 blob 上传或下载分块允许的最大字节数 / MaxChunkBytes is the maximum number of bytes permitted in one blob upload or download chunk
	MaxChunkBytes = 1 << 20
	// DefaultArchivePageSize 是归档列表未指定页大小时返回的默认条目数 / DefaultArchivePageSize is the default number of archive entries returned when no page size is specified
	DefaultArchivePageSize = 128
	// MaxArchivePageSize 是单个归档列表页面允许请求的最大条目数 / MaxArchivePageSize is the maximum number of archive entries requested for one page
	MaxArchivePageSize = 1000
	// MaxArchivePageBytes 是单个序列化归档列表响应允许的最大字节数 / MaxArchivePageBytes is the maximum serialized byte size of one archive-list response
	MaxArchivePageBytes = 2 << 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Engine 执行格式检测、转换、校验和归档操作 / Engine performs format detection, conversion, validation, and archive operations
	Engine *application.Engine
	// Roots 限制 RPC 文件引用能够访问的目录 / Roots confines directories accessible through RPC file references
	Roots *application.RootSet
	// FilesystemMode 控制直接路径输入是否可用 / FilesystemMode controls whether direct path inputs are available
	FilesystemMode FilesystemMode
	// Blobs 保存上传内容和无法安全内联的结果 / Blobs stores uploads and results that cannot be safely inlined
	Blobs *blobstore.Store
	// MaxInlineBytes 限制一个制品集合在消息中内联的合计字节数 / MaxInlineBytes limits aggregate bytes inlined for one artifact bundle
	MaxInlineBytes int64
	// ChunkBytes 指定 blob 下载消息的分块字节数 / ChunkBytes specifies the chunk size in bytes for blob download messages
	ChunkBytes int
}

Config 配置 gRPC 序列化服务器的依赖和传输资源限制 / Config configures dependencies and transport resource limits for a gRPC serialization server

type FilesystemMode

type FilesystemMode string

FilesystemMode 控制 gRPC 请求能否使用服务端本地直接路径 FilesystemMode controls whether gRPC requests may use direct server-local paths

const (
	// FilesystemModeUnrestricted 允许访问进程账号有权限读取的任意普通文件 / FilesystemModeUnrestricted permits reading any regular file allowed by the process account
	FilesystemModeUnrestricted FilesystemMode = "unrestricted"
	// FilesystemModeRestricted 只允许通过已配置根目录访问服务端文件 / FilesystemModeRestricted permits server-local file access only through configured roots
	FilesystemModeRestricted FilesystemMode = "restricted"
)

type Server

type Server struct {
	// UnimplementedSerializationServiceServer 保持新增 RPC 时的向前兼容性 / UnimplementedSerializationServiceServer preserves forward compatibility when RPCs are added
	serializationv1.UnimplementedSerializationServiceServer
	// contains filtered or unexported fields
}

Server 将应用引擎和 blob 存储公开为版本化 gRPC 服务 / Server exposes the application engine and blob store as a versioned gRPC service

func New

func New(config Config) (*Server, error)

New 校验配置并创建版本化 gRPC 序列化服务器 New validates configuration and creates a versioned gRPC serialization server

func (*Server) Convert

Convert 解析输入、执行格式转换并以内联数据或 blob 返回结果 Convert resolves input, performs format conversion, and returns the result as inline data or a blob

func (*Server) DeleteBlob

DeleteBlob 删除指定临时 blob 并报告其是否存在 DeleteBlob removes a temporary blob and reports whether it existed

func (*Server) Detect

Detect 解析 RPC 制品输入并返回检测到的格式元数据 Detect resolves an RPC artifact input and returns detected format metadata

func (*Server) Download

Download 先发送 blob 元数据再以受限大小分块流式发送内容 Download sends blob metadata followed by content streamed in bounded chunks

func (*Server) ExtractArchiveEntry

ExtractArchiveEntry 提取指定归档条目并以内联数据或 blob 返回结果 ExtractArchiveEntry extracts a named archive entry and returns it as inline data or a blob

func (*Server) GetCapabilities

GetCapabilities 返回服务器格式、根目录、blob 和资源限制能力 GetCapabilities returns the server format, root, blob, and resource-limit capabilities

func (*Server) GetFormatGuide

GetFormatGuide 返回指定格式已发布的编辑指南文档 GetFormatGuide returns the published editing guide document for a format

func (*Server) GetFormatSchema

GetFormatSchema 返回指定格式已发布的编辑 JSON 模式 GetFormatSchema returns the published editing JSON schema for a format

func (*Server) ListArchive

ListArchive 返回受条目数和序列化消息大小双重限制的归档页面 ListArchive returns an archive page bounded by both entry count and serialized message size

func (*Server) Register

func (s *Server) Register(registrar grpc.ServiceRegistrar)

Register 将序列化服务实现注册到 gRPC 服务注册器 Register registers the serialization service implementation with a gRPC service registrar

func (*Server) Upload

Upload 接收元数据后的客户端流式分块并保存为临时 blob Upload receives client-streamed chunks after metadata and stores them as a temporary blob

func (*Server) Validate

Validate 解析输入并完整校验指定或自动检测的格式 Validate resolves input and fully validates the specified or automatically detected format

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL