service

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller interface {
	CreateFile(ctx context.Context, req *pb.File) (*pb.CreateFileResponse, error)
	Search(ctx context.Context, req *pb.SearchRequest) (*pb.SearchResponse, error)
	Delete(ctx context.Context, req *pb.DeleteRequest) (*pb.DeleteResponse, error)
	Update(ctx context.Context, req *pb.File) (*pb.UpdateResponse, error)
	HealthCheck(ctx context.Context) (bool, error)
}

Controller is an interface for the business logic of the search.Service which uses a Store.

type Service

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

Service is a structure used for handling Search Service grpc requests.

func NewService

func NewService(controller Controller, logger *logrus.Logger) Service

NewService creates a Service and returns it.

func (Service) CreateFile

func (s Service) CreateFile(ctx context.Context, req *pb.File) (*pb.CreateFileResponse, error)

CreateFile is the request handler for creating a file.

func (Service) Delete

func (s Service) Delete(ctx context.Context, req *pb.DeleteRequest) (*pb.DeleteResponse, error)

Delete is the request handler for deleting a file.

func (Service) HealthCheck

func (s Service) HealthCheck() bool

HealthCheck checks the health of the service, returns true if healthy, or false otherwise.

func (Service) Search

func (s Service) Search(ctx context.Context, req *pb.SearchRequest) (*pb.SearchResponse, error)

Search is the request handler for searching a file.

func (Service) Update

func (s Service) Update(ctx context.Context, req *pb.File) (*pb.UpdateResponse, error)

Update is the request handler for updating a file.

type Store

type Store interface {
	Create(ctx context.Context, file *pb.File) (string, error)
	GetAll(ctx context.Context, filter interface{}) ([]string, error)
	Delete(ctx context.Context, id string) (string, error)
	Update(ctx context.Context, file *pb.File) (string, error)
	HealthCheck(ctx context.Context) (bool, error)
}

Store is an interface for handling the storing of files.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳