本文整理汇总了Golang中github.com/coreos/fleet/debug.Enter_函数的典型用法代码示例。如果您正苦于以下问题:Golang Enter_函数的具体用法?Golang Enter_怎么用?Golang Enter_使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Enter_函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: GetUnitStates
func (s *rpcserver) GetUnitStates(ctx context.Context, filter *pb.UnitStateFilter) (*pb.UnitStates, error) {
if debugRPCServer {
defer debug.Exit_(debug.Enter_())
}
states := make([]*pb.UnitState, 0)
states = append(states, s.localRegistry.UnitStates()...)
if s.hasNonGRPCAgents {
log.Debug("Merging etcd with inmemory unit states in GetUnitStates()")
etcdUnitStates, err := s.etcdRegistry.UnitStates()
if err != nil {
return nil, err
}
unitStateNames := make(map[string]string, len(states))
for _, state := range states {
unitStateNames[state.Name] = state.MachineID
}
for _, state := range etcdUnitStates {
machId, ok := unitStateNames[state.UnitName]
if !ok || (ok && machId != state.MachineID) {
states = append(states, state.ToPB())
}
}
}
return &pb.UnitStates{states}, nil
}
示例2: GetUnits
func (s *rpcserver) GetUnits(ctx context.Context, filter *pb.UnitFilter) (*pb.Units, error) {
if debugRPCServer {
defer debug.Exit_(debug.Enter_())
}
units := make([]pb.Unit, 0)
units = append(units, s.localRegistry.Units()...)
// Check if there are etcd fleet-based agents in the cluster to share the state
if s.hasNonGRPCAgents {
log.Debug("Merging etcd with inmemory units in GetUnits()")
etcdUnits, err := s.etcdRegistry.Units()
if err != nil {
return nil, err
}
unitNames := make(map[string]struct{}, len(units))
for _, unit := range units {
unitNames[unit.Name] = struct{}{}
}
for _, unit := range etcdUnits {
if _, ok := unitNames[unit.Name]; !ok {
units = append(units, unit.ToPB())
}
}
}
return &pb.Units{Units: units}, nil
}
示例3: DestroyUnit
func (r *inmemoryRegistry) DestroyUnit(name string) bool {
if DebugInmemoryRegistry {
defer debug.Exit_(debug.Enter_(name))
}
r.mu.Lock()
defer r.mu.Unlock()
r.unitStatesMu.Lock()
defer r.unitStatesMu.Unlock()
r.heartbeatsMu.Lock()
defer r.heartbeatsMu.Unlock()
deleted := false
if _, exists := r.unitsCache[name]; exists {
delete(r.unitsCache, name)
deleted = true
}
if _, exists := r.scheduledUnits[name]; exists {
delete(r.scheduledUnits, name)
}
if _, exists := r.unitHeartbeats[name]; exists {
delete(r.unitHeartbeats, name)
}
if _, exists := r.unitStates[name]; exists {
delete(r.unitStates, name)
}
return deleted
}
示例4: ClearUnitHeartbeat
func (r *RPCRegistry) ClearUnitHeartbeat(unitName string) {
if DebugRPCRegistry {
defer debug.Exit_(debug.Enter_(unitName))
}
r.getClient().ClearUnitHeartbeat(r.ctx(), &pb.UnitName{unitName})
}
示例5: ClearUnitHeartbeat
func (s *rpcserver) ClearUnitHeartbeat(ctx context.Context, name *pb.UnitName) (*pb.GenericReply, error) {
if debugRPCServer {
defer debug.Exit_(debug.Enter_(name.Name))
}
s.localRegistry.ClearUnitHeartbeat(name.Name)
return &pb.GenericReply{}, nil
}
示例6: UnitHeartbeat
func (s *rpcserver) UnitHeartbeat(ctx context.Context, heartbeat *pb.Heartbeat) (*pb.GenericReply, error) {
if debugRPCServer {
defer debug.Exit_(debug.Enter_(heartbeat))
}
s.localRegistry.UnitHeartbeat(heartbeat.Name, heartbeat.MachineID, time.Duration(heartbeat.TTL)*time.Second)
return &pb.GenericReply{}, nil
}
示例7: DestroyUnit
func (r *RPCRegistry) DestroyUnit(unitName string) error {
if DebugRPCRegistry {
defer debug.Exit_(debug.Enter_(unitName))
}
_, err := r.getClient().DestroyUnit(r.ctx(), &pb.UnitName{unitName})
return err
}
示例8: UnitState
func (r *inmemoryRegistry) UnitState(name string) *pb.UnitState {
if DebugInmemoryRegistry {
defer debug.Exit_(debug.Enter_())
}
r.unitStatesMu.Lock()
defer r.unitStatesMu.Unlock()
return r.stateByMUSKey(name)
}
示例9: CreateUnit
func (r *inmemoryRegistry) CreateUnit(u *pb.Unit) {
if DebugInmemoryRegistry {
defer debug.Exit_(debug.Enter_(u))
}
r.mu.Lock()
defer r.mu.Unlock()
r.unitsCache[u.Name] = *u
}
示例10: GetScheduledUnits
func (s *rpcserver) GetScheduledUnits(ctx context.Context, unitFilter *pb.UnitFilter) (*pb.ScheduledUnits, error) {
if debugRPCServer {
defer debug.Exit_(debug.Enter_())
}
units, err := s.localRegistry.Schedule()
return &pb.ScheduledUnits{Units: units}, err
}
示例11: UnscheduleUnit
func (r *inmemoryRegistry) UnscheduleUnit(unitName, machineid string) {
if DebugInmemoryRegistry {
defer debug.Exit_(debug.Enter_(unitName, machineid))
}
r.mu.Lock()
defer r.mu.Unlock()
delete(r.scheduledUnits, unitName)
}
示例12: GetScheduledUnit
func (s *rpcserver) GetScheduledUnit(ctx context.Context, name *pb.UnitName) (*pb.MaybeScheduledUnit, error) {
if debugRPCServer {
defer debug.Exit_(debug.Enter_(name.Name))
}
su := s.localRegistry.ScheduledUnit(name.Name)
return &pb.MaybeScheduledUnit{IsScheduled: &pb.MaybeScheduledUnit_Unit{Unit: su}}, nil
}
示例13: GetUnitState
func (s *rpcserver) GetUnitState(ctx context.Context, name *pb.UnitName) (*pb.UnitState, error) {
if debugRPCServer {
defer debug.Exit_(debug.Enter_(name.Name))
}
state := s.localRegistry.UnitState(name.Name)
return state, nil
}
示例14: CreateUnit
func (r *RPCRegistry) CreateUnit(j *job.Unit) error {
if DebugRPCRegistry {
defer debug.Exit_(debug.Enter_(j.Name))
}
un := j.ToPB()
_, err := r.getClient().CreateUnit(r.ctx(), &un)
return err
}
示例15: Unit
func (r *inmemoryRegistry) Unit(name string) (pb.Unit, bool) {
if DebugInmemoryRegistry {
defer debug.Exit_(debug.Enter_(name))
}
r.mu.RLock()
defer r.mu.RUnlock()
u, exists := r.unitsCache[name]
return u, exists
}