grpc

package
v0.0.0-...-ef6c487 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const GDefaultMaxSyncDownOperations = 20

Le nombre maximum d'opération que le serveur peut répondre en 1 coup

View Source
const (
	// GUserUUIDKey est la clé utilisée pour stocker l'ID de l'utilisateur dans le contexte gRPC.
	// Comme elle est dans le même package `grpc`, elle sera accessible par les autres fichiers du package.
	GUserUUIDKey contextKey = "user_uuid"
)

Variables

This section is empty.

Functions

func GetUserUUIDFromContext

func GetUserUUIDFromContext(ctx context.Context) (uuid.UUID, error)

GetUserUUIDFromContext extrait l'ID de l'utilisateur du contexte gRPC. Cette fonction est destinée à être utilisée par les handlers de service pour récupérer l'identité de l'utilisateur authentifié.

func RunServer

func RunServer(listenAddr string, registerServices RegisterServiceFunc, opts ...grpc.ServerOption) error

RunServer démarre un serveur gRPC sur le port spécifié. Il prend une fonction en argument pour enregistrer les services nécessaires.

Types

type AdminServer

type AdminServer struct {
	privatepb.UnimplementedAdminServiceServer
	// contains filtered or unexported fields
}

AdminServer est l'implémentation du service gRPC AdminService.

func NewAdminServer

func NewAdminServer(h *database.Handler, snapshotPath string) *AdminServer

NewAdminServer est le constructeur pour AdminServer.

func (*AdminServer) CreateUser

func (*AdminServer) DeleteUser

func (*AdminServer) DoBackupNow

func (*AdminServer) ListUsers

func (*AdminServer) UpdateUser

type AuthInterceptor

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

AuthInterceptor est un intercepteur serveur pour l'authentification.

func NewAuthInterceptor

func NewAuthInterceptor(publicMethods map[string]bool) *AuthInterceptor

NewAuthInterceptor retourne un nouvel intercepteur d'authentification. Il prend en paramètre une map des méthodes qui ne requièrent pas d'authentification.

func (*AuthInterceptor) Unary

func (interceptor *AuthInterceptor) Unary() grpc.UnaryServerInterceptor

Unary retourne une fonction d'interception pour les RPC unaires.

type AuthServer

type AuthServer struct {
	// pb.UnimplementedAuthServiceServer est nécessaire pour la compatibilité ascendante.
	pb.UnimplementedAuthServiceServer
	// contains filtered or unexported fields
}

AuthServer implémente les points de terminaison gRPC pour le service d'authentification. Il agit comme une couche de traduction entre les requêtes gRPC et la logique métier d'authentification. AuthServer est l'implémentation du service gRPC AuthService.

func NewAuthServer

func NewAuthServer(h *database.Handler) *AuthServer

NewAuthServer est le constructeur pour AuthServer.

func (*AuthServer) ChangePassword

func (s *AuthServer) ChangePassword(ctx context.Context, req *pb.ChangePasswordRequest) (*emptypb.Empty, error)

func (*AuthServer) GetHandler

func (s *AuthServer) GetHandler() *database.Handler

GetHandler retourne le handler de base de données. Cette méthode est principalement destinée à être utilisée dans les tests pour initialiser l'état.

func (*AuthServer) Login

func (s *AuthServer) Login(ctx context.Context, req *pb.LoginRequest) (*pb.LoginResponse, error)

Login est le handler pour la requête RPC Login.

func (*AuthServer) Logout

func (s *AuthServer) Logout(ctx context.Context, req *pb.LogoutRequest) (*emptypb.Empty, error)

Logout est le handler pour la requête RPC Logout.

func (*AuthServer) RefreshToken

RefreshToken est le handler pour la requête RPC RefreshToken.

type MessageServer

type MessageServer struct {
	pb.UnimplementedMessageServiceServer
	// contains filtered or unexported fields
}

MessageServer est l'implémentation du service gRPC MessageServerProto.

func NewMessageServer

func NewMessageServer(h *database.Handler) *MessageServer

NewMessageServer est le constructeur pour MessageServer.

func (*MessageServer) SendMessage

func (s *MessageServer) SendMessage(ctx context.Context, req *pb.MessageRequest) (*pb.MessageResponse, error)

type RegisterServiceFunc

type RegisterServiceFunc func(*grpc.Server)

RegisterServiceFunc est un type de fonction utilisé pour enregistrer des services gRPC. Cela permet de rendre la fonction RunServer agnostique des services qu'elle héberge.

type SyncServer

type SyncServer struct {
	pb.UnimplementedSyncServiceServer
	// contains filtered or unexported fields
}

SyncServer est l'implémentation du service gRPC SyncService.

func NewSyncServer

func NewSyncServer(
	db *database.Handler,
	preUpsertHookMap hooks.PreUpsertHookMap,
	postUpsertHookMap hooks.PostUpsertHookMap,
) *SyncServer

NewSyncServer crée une nouvelle instance de SyncServer

func (*SyncServer) SyncDown

func (s *SyncServer) SyncDown(ctx context.Context, req *pb.SyncDownRequest) (*pb.SyncDownResponse, error)

func (*SyncServer) SyncUp

func (s *SyncServer) SyncUp(ctx context.Context, req *pb.SyncUpRequest) (*pb.SyncUpResponse, error)

func (*SyncServer) SyncUpRescue

func (s *SyncServer) SyncUpRescue(ctx context.Context, req *pb.SyncUpRequestRescue) (*pb.SyncUpResponse, error)

Jump to

Keyboard shortcuts

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