// AddNote スタートアップスクリプト 追加
513359
func (d *DiskEditValue) AddNote(noteID string) {
	if d.Notes == nil {
		d.Notes = []*Resource{}
	}
	d.Notes = append(d.Notes, NewResourceByStringID(noteID))
}
1107245
func (l *LinkNode) AddAddress(addr net.Addr) error {
	for _, a := range l.Addresses {
		if a.String() == addr.String() {
			return nil
		}
	}

	l.Addresses = append(l.Addresses, addr)

	return l.Sync()
}
699572
func (b *Batch) Add(doc interface{}) {
	b.Docs = append(b.Docs, doc)
}
968289
func (a *AuthorizationUpdateRequest) GetNote() string {
	if a == nil || a.Note == nil {
		return ""
	}
	return *a.Note
}
913515
func (b *DiskBuilder) AddNoteID(noteID int64) {
	b.noteIDs = append(b.noteIDs, noteID)
}
479961
func (c *Client) List() ([]*Note, error) {
	var res []*Note
	var mark string
	for {
		curr, err := c.listRaw(mark)
		if err != nil {
			return nil, err
		}
		for _, nd := range curr.Notes {
			updateNoteData(nd)
			n := nd.Note
			if n.ID == "" {
				log.Fatalf("n.ID is empty on %v\n", n)
			}
			res = append(res, n)
		}
		mark = curr.Mark
		if mark == "" {
			break
		}
	}
	return res, nil
}
261969
func (p *Pages) AddView(addr string, v Views) {
	v.UseHistory(p.HistoryProvider)
	p.UseState(addr, v)
}
856168
func (sd *etcdServiceDiscovery) AddListener(listener SDListener) {
	sd.listeners = append(sd.listeners, listener)
}
1064925
func (a *Client) AddOne(params *AddOneParams, authInfo runtime.ClientAuthInfoWriter) (*AddOneCreated, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewAddOneParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "addOne",
		Method:             "POST",
		PathPattern:        "/",
		ProducesMediaTypes: []string{"application/io.swagger.examples.todo-list.v1+json"},
		ConsumesMediaTypes: []string{"application/io.swagger.examples.todo-list.v1+json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &AddOneReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*AddOneCreated), nil

}
1037183
func (s *session) AddRecord(key string, member interface{}, unixstamp int64) error {
	action, err := s.addRecord(key, member, unixstamp)
	if err != nil {
		return s.catch("AddRecord: "+action, err)
	}
	return nil
}
977128
func (r *Robot) AddDevice(d Device) Device {
	*r.devices = append(*r.Devices(), d)
	return d
}
1267349
func (c *Client) AddDevice(d contract.Device) (string, error) {
	conn := c.Pool.Get()
	defer conn.Close()

	return addDevice(conn, d)
}
359882
func (mb *builder) AppendReference(d distribution.Describable) error {
	mb.dependencies = append(mb.dependencies, d.Descriptor())
	return nil
}
1357987
func noteEncrypt(mctx libkb.MetaContext, note stellar1.NoteContents, other *keybase1.UserVersion) (res stellar1.EncryptedNote, err error) {
	nbs, err := noteSymmetricKey(mctx, other)
	if err != nil {
		return res, fmt.Errorf("error getting encryption key for note: %v", err)
	}
	if nbs.symmetricKey.IsZero() {
		// This should never happen
		return res, fmt.Errorf("unexpected zero key")
	}
	res, err = noteEncryptHelper(mctx.Ctx(), note, nbs.symmetricKey)
	if err != nil {
		return res, err
	}
	res.Sender = nbs.sender
	res.Recipient = nbs.recipient
	return res, nil
}
1046517
func noteEncryptHelper(ctx context.Context, note stellar1.NoteContents, symmetricKey libkb.NaclSecretBoxKey) (res stellar1.EncryptedNote, err error) {
	// Msgpack
	clearpack, err := libkb.MsgpackEncode(note)
	if err != nil {
		return res, err
	}

	// Secretbox
	var nonce [libkb.NaclDHNonceSize]byte
	nonce, err = libkb.RandomNaclDHNonce()
	if err != nil {
		return res, err
	}
	secbox := secretbox.Seal(nil, clearpack, &nonce, (*[libkb.NaclSecretBoxKeySize]byte)(&symmetricKey))

	return stellar1.EncryptedNote{
		V: 1,
		E: secbox,
		N: nonce,
	}, nil
}
1111367
func (c *Client) GetNote(noteID string, version int) (*Note, error) {
	err := c.loginIfNeeded()
	if err != nil {
		return nil, err
	}
	uri := c.apiURL(fmt.Sprintf("/i/%s/v/%d", noteID, version))
	req, err := http.NewRequest("GET", uri, nil)
	if err != nil {
		return nil, err
	}
	req.Header.Add(tokenHeaderName, c.login.AccessToken)
	d, err := httpReadReq(req)
	if err != nil {
		return nil, err
	}
	c.logRaw("%s\n%s\n\n", uri, string(d))
	//fmt.Printf("resp: '%s'\n", string(d))
	var n Note
	err = json.Unmarshal(d, &n)
	if err != nil {
		//log.Fatalf("failed to unmarshal '%s' with '%s'\n", string(d), err)
		return nil, err
	}
	n.Version = version
	n.ID = noteID
	updateNote(&n)
	return &n, nil
}
163
func (c *replicationLagCache) add(r replicationLagRecord) {
	if !r.Up {
		// Tablet is down. Do no longer track it.
		delete(c.entries, r.Key)
		delete(c.ignoredSlowReplicasInARow, r.Key)
		return
	}

	entry, ok := c.entries[r.Key]
	if !ok {
		entry = newReplicationLagHistory(c.historyCapacityPerReplica)
		c.entries[r.Key] = entry
	}

	entry.add(r)
}