// GetRemoteRegistrationID returns the registration ID of the peer.
769410
func (sc *SessionCipher) GetRemoteRegistrationID() (uint32, error) {
	sr, err := sc.SessionStore.LoadSession(sc.RecipientID, sc.DeviceID)
	if err != nil {
		return 0, err
	}
	return sr.sessionState.getRemoteRegistrationID(), nil
}
716817
func (t *Timeline) GetCommitID() string {
	if t == nil || t.CommitID == nil {
		return ""
	}
	return *t.CommitID
}
1019914
func (repo *Repository) GetAssigneeByID(userID int64) (*User, error) {
	return GetAssigneeByID(repo, userID)
}
428297
func (mc MongoClient) getRegistration(q bson.M) (models.Registration, error) {
	s := mc.getSessionCopy()
	defer s.Close()

	var reg models.Registration
	err := s.DB(mc.database.Name).C(db.ExportCollection).Find(q).One(&reg)
	if err != nil {
		return models.Registration{}, errorMap(err)
	}
	return reg, nil
}
19918
func (d *Downloader) UnregisterPeer(id string) error {
	// Unregister the peer from the active peer set and revoke any fetch tasks
	logger := log.New("peer", id)
	logger.Trace("Unregistering sync peer")
	if err := d.peers.Unregister(id); err != nil {
		logger.Error("Failed to unregister sync peer", "err", err)
		return err
	}
	d.queue.Revoke(id)

	// If this peer was the master peer, abort sync immediately
	d.cancelLock.RLock()
	master := id == d.cancelPeer
	d.cancelLock.RUnlock()

	if master {
		d.cancel()
	}
	return nil
}
1055932
func (p *PullRequestComment) GetCommitID() string {
	if p == nil || p.CommitID == nil {
		return ""
	}
	return *p.CommitID
}
194580
func getRemoteAddr(req *logical.Request) string {
	if req != nil && req.Connection != nil {
		return req.Connection.RemoteAddr
	}
	return ""
}
302088
func (m *Milestone) GetID() int64 {
	if m == nil || m.ID == nil {
		return 0
	}
	return *m.ID
}
383339
func GetRegistry(c context.Context) Registry {
	ret, _ := c.Value(&regKey).(Registry)
	return ret
}
836647
func (s *UploadLayerPartOutput) SetRegistryId(v string) *UploadLayerPartOutput {
	s.RegistryId = &v
	return s
}
1367845
func (p *propZone) GetZoneID() int64 {
	if p.Zone == nil {
		return -1
	}
	return p.Zone.GetID()
}
857788
func (b *DeviceInformationDriver) GetPnPId() (model string) {
	c, _ := b.adaptor().ReadCharacteristic("2a50")
	buf := bytes.NewBuffer(c)
	val := buf.String()
	return val
}
894266
func (sa *StorageAuthority) GetRegistrationByKey(_ context.Context, jwk *jose.JSONWebKey) (core.Registration, error) {
	var test1KeyPublic jose.JSONWebKey
	var test2KeyPublic jose.JSONWebKey
	var test3KeyPublic jose.JSONWebKey
	var test4KeyPublic jose.JSONWebKey
	var testE1KeyPublic jose.JSONWebKey
	var testE2KeyPublic jose.JSONWebKey
	var err error
	err = test1KeyPublic.UnmarshalJSON([]byte(test1KeyPublicJSON))
	if err != nil {
		return core.Registration{}, err
	}
	err = test2KeyPublic.UnmarshalJSON([]byte(test2KeyPublicJSON))
	if err != nil {
		return core.Registration{}, err
	}
	err = test3KeyPublic.UnmarshalJSON([]byte(test3KeyPublicJSON))
	if err != nil {
		return core.Registration{}, err
	}
	err = test4KeyPublic.UnmarshalJSON([]byte(test4KeyPublicJSON))
	if err != nil {
		return core.Registration{}, err
	}
	newKeyBytes, err := ioutil.ReadFile("../test/test-key-5.der")
	if err != nil {
		return core.Registration{}, err
	}
	newKeyPriv, err := x509.ParsePKCS1PrivateKey(newKeyBytes)
	if err != nil {
		return core.Registration{}, err
	}
	test5KeyPublic := jose.JSONWebKey{Key: newKeyPriv.Public()}

	err = testE1KeyPublic.UnmarshalJSON([]byte(testE1KeyPublicJSON))
	if err != nil {
		panic(err)
	}
	err = testE2KeyPublic.UnmarshalJSON([]byte(testE2KeyPublicJSON))
	if err != nil {
		panic(err)
	}

	contacts := []string{"mailto:person@mail.com"}

	if core.KeyDigestEquals(jwk, test1KeyPublic) {
		return core.Registration{
			ID:        1,
			Key:       jwk,
			Agreement: agreementURL,
			Contact:   &contacts,
			Status:    core.StatusValid,
		}, nil
	}

	if core.KeyDigestEquals(jwk, test2KeyPublic) {
		// No key found
		return core.Registration{ID: 2}, berrors.NotFoundError("reg not found")
	}

	if core.KeyDigestEquals(jwk, test4KeyPublic) {
		// No key found
		return core.Registration{ID: 5}, berrors.NotFoundError("reg not found")
	}

	if core.KeyDigestEquals(jwk, test5KeyPublic) {
		// No key found
		return core.Registration{ID: 5}, berrors.NotFoundError("reg not found")
	}

	if core.KeyDigestEquals(jwk, testE1KeyPublic) {
		return core.Registration{ID: 3, Key: jwk, Agreement: agreementURL}, nil
	}

	if core.KeyDigestEquals(jwk, testE2KeyPublic) {
		return core.Registration{ID: 4}, berrors.NotFoundError("reg not found")
	}

	if core.KeyDigestEquals(jwk, test3KeyPublic) {
		// deactivated registration
		return core.Registration{
			ID:        2,
			Key:       jwk,
			Agreement: agreementURL,
			Contact:   &contacts,
			Status:    core.StatusDeactivated,
		}, nil
	}

	// Return a fake registration. Make sure to fill the key field to avoid marshaling errors.
	return core.Registration{ID: 1, Key: &test1KeyPublic, Agreement: agreementURL, Status: core.StatusValid}, nil
}
1210940
func (swap *Swap) GetPeerBalance(peer enode.ID) (int64, error) {
	swap.lock.RLock()
	defer swap.lock.RUnlock()
	if p, ok := swap.balances[peer]; ok {
		return p, nil
	}
	return 0, errors.New("Peer not found")
}
1103141
func (sa *StorageAuthority) GetRegistration(_ context.Context, id int64) (core.Registration, error) {
	if id == 100 {
		// Tag meaning "Missing"
		return core.Registration{}, errors.New("missing")
	}
	if id == 101 {
		// Tag meaning "Malformed"
		return core.Registration{}, nil
	}
	if id == 102 {
		// Tag meaning "Not Found"
		return core.Registration{}, berrors.NotFoundError("Dave's not here man")
	}

	keyJSON := []byte(test1KeyPublicJSON)
	var parsedKey jose.JSONWebKey
	err := parsedKey.UnmarshalJSON(keyJSON)
	if err != nil {
		return core.Registration{}, err
	}

	contacts := []string{"mailto:person@mail.com"}
	goodReg := core.Registration{
		ID:        id,
		Key:       &parsedKey,
		Agreement: agreementURL,
		Contact:   &contacts,
		Status:    core.StatusValid,
	}

	// Return a populated registration with contacts for ID == 1 or ID == 5
	if id == 1 || id == 5 {
		return goodReg, nil
	}

	var test2KeyPublic jose.JSONWebKey
	_ = test2KeyPublic.UnmarshalJSON([]byte(test2KeyPublicJSON))
	if id == 2 {
		goodReg.Key = &test2KeyPublic
		return goodReg, nil
	}

	var test3KeyPublic jose.JSONWebKey
	_ = test3KeyPublic.UnmarshalJSON([]byte(test3KeyPublicJSON))
	// deactivated registration
	if id == 3 {
		goodReg.Key = &test3KeyPublic
		goodReg.Status = core.StatusDeactivated
		return goodReg, nil
	}

	var test4KeyPublic jose.JSONWebKey
	_ = test4KeyPublic.UnmarshalJSON([]byte(test4KeyPublicJSON))
	if id == 4 {
		goodReg.Key = &test4KeyPublic
		return goodReg, nil
	}

	// ID 6 == an account without the agreement set
	if id == 6 {
		goodReg.Agreement = ""
		return goodReg, nil
	}

	goodReg.InitialIP = net.ParseIP("5.6.7.8")
	goodReg.CreatedAt = time.Date(2003, 9, 27, 0, 0, 0, 0, time.UTC)
	return goodReg, nil
}
1164059
func (s *GetDownloadUrlForLayerInput) SetRegistryId(v string) *GetDownloadUrlForLayerInput {
	s.RegistryId = &v
	return s
}
364487
func (c Client) GetPrimaryUUID() (uuid string, err error) {
	states, err := c.ListNodes()
	if err != nil {
		return "", err
	}

	for _, s := range states {
		if s.Host == c.clientIP {
			return s.UUID, nil
		}
	}
	return "", fmt.Errorf("No node found with IP '%s', available nodes %+v", c.clientIP, states)
}