service

package
v0.0.0-...-4a740ba Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = er.New(mediatype.New("domain/service.protocol.error; name=not-found").SetDetail(protocol.LanguageEnglish, domainEnglish,
		"Not Found",
		"Requested service by given identifier not found in this application",
		"",
		"",
		nil).
		Expired(0, nil))

	ErrServiceNotAcceptSRPC = er.New(mediatype.New("domain/service.protocol.error; name=service-not-accept-srpc").SetDetail(protocol.LanguageEnglish, domainEnglish,
		"Service Not Accept sRPC",
		"Requested service by given ID not accept sRPC protocol in this server",
		"Try other server or contact support of the software",
		"It is so easy to implement sRPC handler for a service! Take a time and do it!",
		nil).
		SetDetail(protocol.LanguagePersian, domainPersian,
			"سرویس پروتکل sRPC را پشتیبانی نمی کند",
			"درخواست برای سرویس با شماره داده شده بدلیل عدم پشتیبانی پروتکل مدنظر قابلیت انجام روی سرور فعلی را ندارد",
			"سرور دیگر را امتحان کنید یا با پشتیبانی پلتفرم تماس بگیرید",
			"پیاده سازی این پروتکل برای پاسخ گویی به سرویس ها به شدت ساده است، وقتی برای پیاده سازی اختصاص دهید",
			nil).
		Expired(0, nil))

	ErrServiceNotAcceptSRPCDirect = er.New(mediatype.New("domain/service.protocol.error; name=service-not-accept-direct-srpc").SetDetail(protocol.LanguageEnglish, domainEnglish,
		"Service Not Accept Direct sRPC",
		"Requested service by given ID not accept direct sRPC protocol in this server",
		"Try other server or contact support of the software",
		"",
		nil).
		SetDetail(protocol.LanguagePersian, domainPersian,
			"پرسش مستقیم پشتیبانی نمی شود",
			"درخواست برای سرویس با شماره داده شده بدلیل عدم پشتیبانی پروتکل مدنظر قابلیت انجام روی سرور فعلی را ندارد",
			"سرور دیگر را امتحان کنید یا با پشتیبانی پلتفرم تماس بگیرید",
			"پیاده سازی این پروتکل برای پاسخ گویی به سرویس ها به شدت ساده است، در صورت تمایل به پشتیبانی وقتی برای پیاده سازی اختصاص دهید",
			nil).
		Expired(0, nil))

	ErrServiceNotAcceptHTTP = er.New(mediatype.New("domain/service.protocol.error; name=service-not-accept-http").SetDetail(protocol.LanguageEnglish, domainEnglish,
		"Service Not Accept HTTP",
		"Requested service by given ID not accept HTTP protocol in this server",
		"Try other server or contact support of the software",
		"It is so easy to implement HTTP handler for a service! Take a time and do it!",
		nil).
		SetDetail(protocol.LanguagePersian, domainPersian,
			"پروتکل HTTP پشتیبانی نمی شود",
			"درخواست برای سرویس با شماره داده شده بدلیل عدم پشتیبانی پروتکل مدنظر قابلیت انجام روی سرور فعلی را ندارد",
			"سرور دیگر را امتحان کنید یا با پشتیبانی پلتفرم تماس بگیرید",
			"پیاده سازی این پروتکل برای پاسخ گویی به سرویس ها به شدت ساده است، وقتی برای پیاده سازی اختصاص دهید",
			nil).
		Expired(0, nil))
)

Declare Errors Details

Functions

This section is empty.

Types

type Service

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

Service store needed data for a service to implement protocol.Service when embed to other struct that implements other methods!

func New

func New(uri string, mediatype *mediatype.MediaType) (s *Service)

New returns a new error!

func (*Service) CRUDType

func (s *Service) CRUDType() protocol.CRUD

func (*Service) ID

func (s *Service) ID() uint64

func (*Service) MediaType

func (s *Service) MediaType() protocol.MediaType

func (*Service) Priority

func (s *Service) Priority() protocol.Priority

func (*Service) ServeHTTP

func (s *Service) ServeHTTP(st protocol.Stream, httpReq protocol.HTTPRequest, httpRes protocol.HTTPResponse) (err protocol.Error)

func (*Service) ServeSRPC

func (s *Service) ServeSRPC(st protocol.Stream) (err protocol.Error)

func (*Service) ServeSRPCDirect

func (s *Service) ServeSRPCDirect(conn protocol.Connection, request []byte) (response []byte, err protocol.Error)

func (*Service) SetAuthorization

func (s *Service) SetAuthorization(crud protocol.CRUD, userType protocol.UserType) *Service

func (*Service) SetPriority

func (s *Service) SetPriority(priority protocol.Priority, weight protocol.Weight) *Service

func (*Service) URI

func (s *Service) URI() string

func (*Service) UserType

func (s *Service) UserType() protocol.UserType

func (*Service) Weight

func (s *Service) Weight() protocol.Weight

type Services

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

Services store all application service

func (*Services) DeleteService

func (ss *Services) DeleteService(s protocol.Service)

DeleteService use to delete specific service in services list.

func (*Services) GetServiceByID

func (ss *Services) GetServiceByID(serviceID uint64) protocol.Service

GetServiceByID use to get specific service handler by service ID

func (*Services) GetServiceByMediaType

func (ss *Services) GetServiceByMediaType(mt string) protocol.Service

GetServiceByMediaType use to get specific service handler by service URI

func (*Services) GetServiceByURI

func (ss *Services) GetServiceByURI(uri string) protocol.Service

GetServiceByURI use to get specific service handler by service URI path

func (*Services) Init

func (ss *Services) Init()

Init use to initialize

func (*Services) RegisterService

func (ss *Services) RegisterService(s protocol.Service)

RegisterService use to set or change specific service detail!

Jump to

Keyboard shortcuts

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