// Constructs a ServiceEntry structure by given arguments
342116
func NewServiceEntry(instance, service, domain string) *ServiceEntry {
	return &ServiceEntry{
		*NewServiceRecord(instance, service, domain),
		"",
		0,
		[]string{},
		0,
		nil,
		nil,
	}
}
739873
func (dt *dynamicTimeout) logEntry(duration time.Duration) {
	entries := int(atomic.AddInt64(&dt.entries, 1))
	index := entries - 1
	if index < dynamicTimeoutLogSize {
		dt.mutex.Lock()
		dt.log[index] = duration
		dt.mutex.Unlock()
	}
	if entries == dynamicTimeoutLogSize {
		dt.mutex.Lock()

		// Make copy on stack in order to call adjust()
		logCopy := [dynamicTimeoutLogSize]time.Duration{}
		copy(logCopy[:], dt.log[:])

		// reset log entries
		atomic.StoreInt64(&dt.entries, 0)

		dt.mutex.Unlock()

		dt.adjust(logCopy)
	}
}
1240313
func (c *Client) ListLogentries(i *ListLogentriesInput) ([]*Logentries, error) {
	if i.Service == "" {
		return nil, ErrMissingService
	}

	if i.Version == 0 {
		return nil, ErrMissingVersion
	}

	path := fmt.Sprintf("/service/%s/version/%d/logging/logentries", i.Service, i.Version)
	resp, err := c.Get(path, nil)
	if err != nil {
		return nil, err
	}

	var ls []*Logentries
	if err := decodeJSON(&ls, resp.Body); err != nil {
		return nil, err
	}
	sort.Stable(logentriesByName(ls))
	return ls, nil
}
881610
func NewClearEventsArgs(service ServiceName) *ClearEventsArgs {
	args := new(ClearEventsArgs)
	args.Service = service
	return args
}
714935
func (r *Room) Entry(ctx context.Context) (*protos.Response, error) {
	fakeUID := uuid.New().String() // just use s.ID as uid !!!
	s := pitaya.GetSessionFromCtx(ctx)
	err := s.Bind(ctx, fakeUID) // binding session uid
	if err != nil {
		return nil, pitaya.Error(err, "ENT-000")
	}
	return reply(200, "ok"), nil
}
121548
func (t *HTTPTransporter) appendEntriesHandler(server Server) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		traceln(server.Name(), "RECV /appendEntries")

		req := &AppendEntriesRequest{}
		if _, err := req.Decode(r.Body); err != nil {
			http.Error(w, "", http.StatusBadRequest)
			return
		}

		resp := server.AppendEntries(req)
		if resp == nil {
			http.Error(w, "Failed creating response.", http.StatusInternalServerError)
			return
		}
		if _, err := resp.Encode(w); err != nil {
			http.Error(w, "", http.StatusInternalServerError)
			return
		}
	}
}
774570
func (e *Env) SetEntry(entry string) {
	if e.env == nil {
		e.env = make(map[string]string)
	}

	// "entry" must be a well-formed "key=value" entry. If it doesn't have an "=",
	// we will forcibly add one to make it well-formed.
	if strings.IndexRune(entry, '=') < 0 {
		entry += "="
	}
	k, _ := Split(entry)
	if len(k) > 0 {
		e.env[e.normalizeKey(k)] = entry
	}
}
929696
func (c *Client) CreateLogentries(i *CreateLogentriesInput) (*Logentries, error) {
	if i.Service == "" {
		return nil, ErrMissingService
	}

	if i.Version == 0 {
		return nil, ErrMissingVersion
	}

	path := fmt.Sprintf("/service/%s/version/%d/logging/logentries", i.Service, i.Version)
	resp, err := c.PostForm(path, i, nil)
	if err != nil {
		return nil, err
	}

	var l *Logentries
	if err := decodeJSON(&l, resp.Body); err != nil {
		return nil, err
	}
	return l, nil
}
775276
func serviceToAgentService(svc *structs.ServiceDefinition) (*api.AgentServiceRegistration, error) {
	// mapstructure can do this for us, but we encapsulate it in this
	// helper function in case we need to change the logic in the future.
	var result api.AgentServiceRegistration
	d, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
		Result:           &result,
		DecodeHook:       timeDurationToStringHookFunc(),
		WeaklyTypedInput: true,
	})
	if err != nil {
		return nil, err
	}
	if err := d.Decode(svc); err != nil {
		return nil, err
	}

	// The structs version has non-pointer checks and the destination
	// has pointers, so we need to set the destination to nil if there
	// is no check ID set.
	if result.Check != nil && result.Check.Name == "" {
		result.Check = nil
	}
	if len(result.Checks) == 1 && result.Checks[0].Name == "" {
		result.Checks = nil
	}

	return &result, nil
}
400580
func newEntry(p *BzzAddr) *entry {
	return &entry{
		BzzAddr: p,
		seenAt:  time.Now(),
	}
}
728933
func NewEntry() Entry {
	e := Entry{}
	e.Times = NewTimeData()
	e.UUID = NewUUID()
	return e
}
339007
func NewEntry(duration time.Duration) *Entry {
	// if given duration is not <=0 (which means finds from the headers)
	// then we should check for the MinimumCacheDuration here
	if duration >= 0 && duration < cfg.MinimumCacheDuration {
		duration = cfg.MinimumCacheDuration
	}

	return &Entry{
		life:     duration,
		response: &Response{},
	}
}
1143724
func (reader *Reader) SeekToEntry(entry *dwarf.Entry) error {
	reader.Seek(entry.Offset)
	// Consume the current entry so .Next works as intended
	_, err := reader.Next()
	return err
}
1069621
func (s *stage) createEntries(entries []filesystemEntry) error {
	s.Logger.PushPrefix("createFiles")
	defer s.Logger.PopPrefix()

	for _, e := range entries {
		path := e.node().Path
		if !strings.HasPrefix(path, s.DestDir) {
			panic(fmt.Sprintf("Entry path %s isn't under prefix %s", path, s.DestDir))
		}

		if err := s.relabelDirsForFile(path); err != nil {
			return fmt.Errorf("error relabeling paths for %s: %v", path, err)
		}
		if err := s.removePathOnOverwrite(e); err != nil {
			return fmt.Errorf("error removing existing file %s: %v", path, err)
		}
		if err := e.create(s.Logger, s.Util); err != nil {
			return fmt.Errorf("error creating %s: %v", path, err)
		}
	}
	return nil
}
820009
func (c *channelMap) findEntry(id int64) entry {
	var v entry
	var ok bool
	if v, ok = c.channels[id]; ok {
		return v
	}
	if v, ok = c.subChannels[id]; ok {
		return v
	}
	if v, ok = c.servers[id]; ok {
		return v
	}
	if v, ok = c.listenSockets[id]; ok {
		return v
	}
	if v, ok = c.normalSockets[id]; ok {
		return v
	}
	return &dummyEntry{idNotFound: id}
}
429507
func (c *ServicedCli) buildServicePaths(svcs []service.ServiceDetails) (map[string]string, error) {
	svcMap := make(map[string]service.ServiceDetails)
	for _, svc := range svcs {
		svcMap[svc.ID] = svc
	}

	// likely that svcs contains all services since it was likely populated with getServices()
	// however, ensure that parent services are in svcMap
	for _, svc := range svcs {
		parentID := svc.ParentServiceID
		for parentID != "" {
			if _, ok := svcMap[parentID]; ok {
				break // break from inner for loop
			}
			svc, err := c.driver.GetServiceDetails(parentID)
			if err != nil || svc == nil {
				return nil, fmt.Errorf("unable to retrieve service for id:%s %s", parentID, err)
			}
			svcMap[parentID] = *svc

			parentID = svc.ParentServiceID
		}
	}

	// recursively build full path for all services
	pathmap := make(map[string]string)
	for _, svc := range svcs {
		fullpath := svc.Name
		parentServiceID := svc.ParentServiceID

		for parentServiceID != "" {
			fullpath = path.Join(svcMap[parentServiceID].Name, fullpath)
			parentServiceID = svcMap[parentServiceID].ParentServiceID
		}

		pathmap[svc.ID] = strings.ToLower(fullpath)
	}

	return pathmap, nil
}
128696
func (s *Trace) AddEntry(lineNumber int, packageName, fileName, methodName string) {
	*s = append(*s, &TraceElement{lineNumber, packageName, fileName, methodName})
}