本文整理汇总了Golang中github.com/coreos/fleet/debug.Enter_函数的典型用法代码示例。如果您正苦于以下问题:Golang Enter_函数的具体用法?Golang Enter_怎么用?Golang Enter_使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Enter_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
开发者ID:jonboulle,项目名称:fleet,代码行数:28,代码来源:rpcserver.go
示例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
}
开发者ID:jonboulle,项目名称:fleet,代码行数:28,代码来源:rpcserver.go
示例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
}
开发者ID:jonboulle,项目名称:fleet,代码行数:32,代码来源:inmemory.go
示例4: ClearUnitHeartbeat
func (r *RPCRegistry) ClearUnitHeartbeat(unitName string) {
if DebugRPCRegistry {
defer debug.Exit_(debug.Enter_(unitName))
}
r.getClient().ClearUnitHeartbeat(r.ctx(), &pb.UnitName{unitName})
}
开发者ID:jonboulle,项目名称:fleet,代码行数:7,代码来源:rpcregistry.go
示例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
}
开发者ID:jonboulle,项目名称:fleet,代码行数:8,代码来源:rpcserver.go
示例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
}
开发者ID:jonboulle,项目名称:fleet,代码行数:8,代码来源:rpcserver.go
示例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
}
开发者ID:jonboulle,项目名称:fleet,代码行数:8,代码来源:rpcregistry.go
示例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)
}
开发者ID:jonboulle,项目名称:fleet,代码行数:9,代码来源:inmemory.go
示例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
}
开发者ID:jonboulle,项目名称:fleet,代码行数:9,代码来源:inmemory.go
示例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
}
开发者ID:jonboulle,项目名称:fleet,代码行数:9,代码来源:rpcserver.go
示例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)
}
开发者ID:jonboulle,项目名称:fleet,代码行数:9,代码来源:inmemory.go
示例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
}
开发者ID:jonboulle,项目名称:fleet,代码行数:9,代码来源:rpcserver.go
示例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
}
开发者ID:jonboulle,项目名称:fleet,代码行数:9,代码来源:rpcserver.go
示例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
}
开发者ID:jonboulle,项目名称:fleet,代码行数:9,代码来源:rpcregistry.go
示例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
}
开发者ID:jonboulle,项目名称:fleet,代码行数:10,代码来源:inmemory.go
示例16: UnscheduleUnit
func (s *rpcserver) UnscheduleUnit(ctx context.Context, unit *pb.UnscheduleUnitRequest) (*pb.GenericReply, error) {
if debugRPCServer {
defer debug.Exit_(debug.Enter_(unit.Name, unit.MachineID))
}
err := s.etcdRegistry.UnscheduleUnit(unit.Name, unit.MachineID)
if err == nil {
s.localRegistry.UnscheduleUnit(unit.Name, unit.MachineID)
}
return &pb.GenericReply{}, err
}
开发者ID:jonboulle,项目名称:fleet,代码行数:11,代码来源:rpcserver.go
示例17: ClearUnitHeartbeat
func (r *inmemoryRegistry) ClearUnitHeartbeat(name string) {
if DebugInmemoryRegistry {
defer debug.Exit_(debug.Enter_(name))
}
r.heartbeatsMu.Lock()
defer r.heartbeatsMu.Unlock()
if _, exists := r.unitHeartbeats[name]; exists {
delete(r.unitHeartbeats, name)
}
}
开发者ID:jonboulle,项目名称:fleet,代码行数:11,代码来源:inmemory.go
示例18: CreateUnit
func (s *rpcserver) CreateUnit(ctx context.Context, u *pb.Unit) (*pb.GenericReply, error) {
if debugRPCServer {
defer debug.Exit_(debug.Enter_(u.Name))
}
err := s.etcdRegistry.CreateUnit(rpcUnitToJobUnit(u))
if err == nil {
s.localRegistry.CreateUnit(u)
}
return &pb.GenericReply{}, err
}
开发者ID:jonboulle,项目名称:fleet,代码行数:11,代码来源:rpcserver.go
示例19: DestroyUnit
func (s *rpcserver) DestroyUnit(ctx context.Context, name *pb.UnitName) (*pb.GenericReply, error) {
if debugRPCServer {
defer debug.Exit_(debug.Enter_(name.Name))
}
err := s.etcdRegistry.DestroyUnit(name.Name)
if err == nil {
s.localRegistry.DestroyUnit(name.Name)
}
return &pb.GenericReply{}, err
}
开发者ID:jonboulle,项目名称:fleet,代码行数:11,代码来源:rpcserver.go
示例20: UnscheduleUnit
func (r *RPCRegistry) UnscheduleUnit(unitName, machID string) error {
if DebugRPCRegistry {
defer debug.Exit_(debug.Enter_(unitName, machID))
}
_, err := r.getClient().UnscheduleUnit(r.ctx(), &pb.UnscheduleUnitRequest{
Name: unitName,
MachineID: machID,
})
return err
}
开发者ID:jonboulle,项目名称:fleet,代码行数:11,代码来源:rpcregistry.go
注:本文中的github.com/coreos/fleet/debug.Enter_函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论