github.com/15mga/kiwi@v0.0.2-0.20240324021231-b95d5c3ac751/gate.go (about)

     1  package kiwi
     2  
     3  import (
     4  	"github.com/15mga/kiwi/util"
     5  )
     6  
     7  var (
     8  	_Gate IGate
     9  )
    10  
    11  func Gate() IGate {
    12  	return _Gate
    13  }
    14  
    15  func SetGate(gate IGate) {
    16  	_Gate = gate
    17  }
    18  
    19  type (
    20  	GateReceiver func(agent IAgent, svc, method string, head util.M, body []byte, fnErr util.FnErr)
    21  )
    22  
    23  type IGate interface {
    24  	Dispose() *util.Err
    25  	Send(tid int64, id string, bytes []byte, handler util.FnBool)
    26  	AddrSend(tid int64, addr string, bytes []byte, handler util.FnBool)
    27  	MultiSend(tid int64, idToPayload map[string][]byte, handler util.FnMapBool)
    28  	MultiAddrSend(tid int64, addrToPayload map[string][]byte, handler util.FnMapBool)
    29  	AllSend(tid int64, bytes []byte)
    30  	CloseWithId(tid int64, id string, removeHeadKeys, removeCacheKeys []string)
    31  	CloseWithAddr(tid int64, addr string, removeHeadKeys, removeCacheKeys []string)
    32  	UpdateHeadCache(tid int64, id string, head, cache util.M, handler util.FnBool)
    33  	UpdateAddrHeadCache(tid int64, addr string, head, cache util.M, handler util.FnBool)
    34  	RemoveHeadCache(tid int64, addr string, head, cache []string, handler util.FnBool)
    35  	RemoveAddrHeadCache(tid int64, addr string, head, cache []string, handler util.FnBool)
    36  	GetHeadCache(tid int64, id string, fn util.FnM2Bool)
    37  	GetAddrHeadCache(tid int64, id string, fn util.FnM2Bool)
    38  	SetRoles(m map[TSvcCode][]int64)
    39  	Authenticate(mask int64, svc TSvc, code TCode) bool
    40  }