service

package
v0.0.0-...-7404c28 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 51 Imported by: 0

Documentation

Overview

Package service NOTES

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FeedStreamAuthInterceptor

func FeedStreamAuthInterceptor(
	srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

FeedStreamAuthInterceptor feed 鉴权中间件

func FeedUnaryAuthInterceptor

func FeedUnaryAuthInterceptor(
	ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

FeedUnaryAuthInterceptor feed 鉴权中间件

func FeedUnaryUpdateLastConsumedTimeInterceptor

func FeedUnaryUpdateLastConsumedTimeInterceptor(ctx context.Context, req interface{},
	info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

FeedUnaryUpdateLastConsumedTimeInterceptor feed 更新拉取时间中间件

Types

type ErrorResponse

type ErrorResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

ErrorResponse 定义错误响应结构

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service do all the data service's work

func NewService

func NewService(sd serviced.Discover, name string) (*Service, error)

NewService create a service instance.

func (*Service) AsyncDownload

func (s *Service) AsyncDownload(ctx context.Context, req *pbfs.AsyncDownloadReq) (*pbfs.AsyncDownloadResp, error)

AsyncDownload 异步 p2p 下载,文件名为 sha256

func (*Service) AsyncDownloadStatus

func (s *Service) AsyncDownloadStatus(ctx context.Context, req *pbfs.AsyncDownloadStatusReq) (
	*pbfs.AsyncDownloadStatusResp, error)

AsyncDownloadStatus 查询异步 p2p 下载任务状态

func (*Service) DownloadFile

func (s *Service) DownloadFile(w http.ResponseWriter, r *http.Request)

DownloadFile download file from provider repo nolint:funlen

func (*Service) GetDownloadURL

func (s *Service) GetDownloadURL(ctx context.Context, req *pbfs.GetDownloadURLReq) (
	*pbfs.GetDownloadURLResp, error)

GetDownloadURL get the download url of the file.

func (*Service) GetKvValue

func (s *Service) GetKvValue(ctx context.Context, req *pbfs.GetKvValueReq) (*pbfs.GetKvValueResp, error)

GetKvValue get kv value

func (*Service) GetSingleFileContent

func (s *Service) GetSingleFileContent(req *pbfs.GetSingleFileContentReq,
	stream pbfs.Upstream_GetSingleFileContentServer) error

GetSingleFileContent 获取单文件内容 nolint:funlen

func (*Service) GetSingleKvMeta

func (s *Service) GetSingleKvMeta(ctx context.Context, req *pbfs.GetSingleKvValueReq) (
	*pbfs.GetSingleKvMetaResp, error)

GetSingleKvMeta 获取单个kv mate data

func (*Service) GetSingleKvValue

func (s *Service) GetSingleKvValue(ctx context.Context, req *pbfs.GetSingleKvValueReq) (
	*pbfs.GetSingleKvValueResp, error)

GetSingleKvValue 获取单个kv

func (*Service) Handshake

func (s *Service) Handshake(ctx context.Context, hm *pbfs.HandshakeMessage) (*pbfs.HandshakeResp, error)

Handshake received handshake from sidecar to validate the app instance's authorization and legality.

func (*Service) HealthyHandler

func (s *Service) HealthyHandler(w http.ResponseWriter, r *http.Request)

HealthyHandler livenessProbe 健康检查

func (*Service) Healthz

func (s *Service) Healthz(w http.ResponseWriter, req *http.Request)

Healthz check whether the service is healthy.

func (*Service) ListApps

func (s *Service) ListApps(ctx context.Context, req *pbfs.ListAppsReq) (*pbfs.ListAppsResp, error)

ListApps 获取服务列表

func (*Service) ListFileAppLatestReleaseMetaRest

func (s *Service) ListFileAppLatestReleaseMetaRest(r *http.Request) (interface{}, error)

ListFileAppLatestReleaseMetaRest list an app's latest release metadata only when the app's configures is file type.

func (*Service) ListenAndGwServerRest

func (s *Service) ListenAndGwServerRest() error

ListenAndGwServerRest listen and grpc-gateway serve the restful server

func (*Service) ListenAndServeRest

func (s *Service) ListenAndServeRest() error

ListenAndServeRest listen and serve the restful server

func (*Service) Messaging

func (s *Service) Messaging(ctx context.Context, msg *pbfs.MessagingMeta) (*pbfs.MessagingResp, error)

Messaging received messages delivered from sidecar. nolint:funlen

func (*Service) PullAppFileMeta

func (s *Service) PullAppFileMeta(ctx context.Context, req *pbfs.PullAppFileMetaReq) (
	*pbfs.PullAppFileMetaResp, error)

PullAppFileMeta pull an app's latest release metadata only when the app's configures is file type. nolint:funlen

func (*Service) PullKvMeta

func (s *Service) PullKvMeta(ctx context.Context, req *pbfs.PullKvMetaReq) (*pbfs.PullKvMetaResp, error)

PullKvMeta pull an app's latest release metadata only when the app's configures is kv type.

func (*Service) ReadyHandler

func (s *Service) ReadyHandler(w http.ResponseWriter, r *http.Request)

ReadyHandler ReadinessProbe 健康检查

func (*Service) UpdateLastConsumedTime

func (s *Service) UpdateLastConsumedTime(next http.Handler) http.Handler

UpdateLastConsumedTime 更新服务拉取时间中间件

func (*Service) Watch

Watch the change message from feed server for sidecar.

Jump to

Keyboard shortcuts

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