Documentation ¶
Index ¶
- Constants
- Variables
- type SRpcService
- func (self *SRpcService) AddConfig(ctx context.Context, service string, config notifyv2.SConfig) error
- func (self *SRpcService) BatchSend(ctx context.Context, contactType string, args apis.BatchSendParams) ([]*apis.FailedRecord, error)
- func (self *SRpcService) ContactByMobile(ctx context.Context, mobile, serviceName string, domainId string) (string, error)
- func (self *SRpcService) DeleteConfig(ctx context.Context, service, domainId string) error
- func (self *SRpcService) InitAll() error
- func (self *SRpcService) Send(ctx context.Context, contactType string, args apis.SendParams) error
- func (self *SRpcService) SendRobotMessage(ctx context.Context, rType string, receivers []*apis.SReceiver, title string, ...) ([]*apis.FailedRecord, error)
- func (self *SRpcService) StopAll()
- func (self *SRpcService) UpdateConfig(ctx context.Context, service string, config notifyv2.SConfig) error
- func (self *SRpcService) UpdateServices(ctx context.Context, usreCred mcclient.TokenCredential, isStart bool)
- func (self *SRpcService) ValidateConfig(ctx context.Context, cType string, configs map[string]string) (isValid bool, message string, err error)
- type ServiceMap
- func (sm *ServiceMap) BatchRemove(serviceNames []string)
- func (sm *ServiceMap) Get(serviceName string) (*apis.SendNotificationClient, bool)
- func (sm *ServiceMap) IsExist(serviceName string) bool
- func (sm *ServiceMap) Len() int
- func (sm *ServiceMap) Map(f func(*apis.SendNotificationClient))
- func (sm *ServiceMap) Remove(serviceName string)
- func (sm *ServiceMap) ServiceNames() []string
- func (sm *ServiceMap) Set(service *apis.SendNotificationClient, serviceName string)
Constants ¶
const ( // ErrSendServiceNotFound means SRpcService's SendSerivces hasn't this Send Service. ErrSendServiceNotFound = errors.Error("No such send service") )
Variables ¶
var ErrGetConfig = errors.Error("Get Config Failed")
Functions ¶
This section is empty.
Types ¶
type SRpcService ¶
type SRpcService struct { SendServices *ServiceMap // contains filtered or unexported fields }
SRpcService provide rpc service about sending message for notify module and manage these services. SendServices storage all send service.
func NewSRpcService ¶
func NewSRpcService(socketFileDir string, configStore notifyv2.IServiceConfigStore, tempalteStore notifyv2.ITemplateStore) *SRpcService
NewSRpcService create a SRpcService
func (*SRpcService) BatchSend ¶
func (self *SRpcService) BatchSend(ctx context.Context, contactType string, args apis.BatchSendParams) ([]*apis.FailedRecord, error)
func (*SRpcService) ContactByMobile ¶
func (*SRpcService) DeleteConfig ¶
func (self *SRpcService) DeleteConfig(ctx context.Context, service, domainId string) error
func (*SRpcService) InitAll ¶
func (self *SRpcService) InitAll() error
InitAll init all Send Services, the init process is that: find all socket file in directory 'self.socketFileDir', if wrong return error; the name of file is the service's name; then try to dial to this rpc service through corresponding socket file, if failed, only print log but not return error.
func (*SRpcService) Send ¶
func (self *SRpcService) Send(ctx context.Context, contactType string, args apis.SendParams) error
Send call the corresponding rpc server to send messager.
func (*SRpcService) SendRobotMessage ¶
func (*SRpcService) StopAll ¶
func (self *SRpcService) StopAll()
StopAll stop all send service in self.SenderServices normally which can delete the socket file.
func (*SRpcService) UpdateConfig ¶
func (self *SRpcService) UpdateConfig(ctx context.Context, service string, config notifyv2.SConfig) error
UpdateConfig can update config for rpc service with domainId
func (*SRpcService) UpdateServices ¶
func (self *SRpcService) UpdateServices(ctx context.Context, usreCred mcclient.TokenCredential, isStart bool)
UpdateServices will detect the self.sockFileDir, add new service and delete disappeared one from self.SendServices.
type ServiceMap ¶
type ServiceMap struct {
// contains filtered or unexported fields
}
ServiceMap has a map of string and apis.SendNotification's pointer, and a RWMutex lock protect map.
func NewServiceMap ¶
func NewServiceMap() *ServiceMap
func (*ServiceMap) BatchRemove ¶
func (sm *ServiceMap) BatchRemove(serviceNames []string)
func (*ServiceMap) Get ¶
func (sm *ServiceMap) Get(serviceName string) (*apis.SendNotificationClient, bool)
func (*ServiceMap) IsExist ¶
func (sm *ServiceMap) IsExist(serviceName string) bool
func (*ServiceMap) Len ¶
func (sm *ServiceMap) Len() int
func (*ServiceMap) Map ¶
func (sm *ServiceMap) Map(f func(*apis.SendNotificationClient))
func (*ServiceMap) Remove ¶
func (sm *ServiceMap) Remove(serviceName string)
func (*ServiceMap) ServiceNames ¶
func (sm *ServiceMap) ServiceNames() []string
func (*ServiceMap) Set ¶
func (sm *ServiceMap) Set(service *apis.SendNotificationClient, serviceName string)