// AddEntry adds a new entry to the bundle. It automatically adds additional transactions if the signature
// message fragments don't fit into one transaction.
6857
func AddEntry(txs Bundle, bndlEntry BundleEntry) Bundle {
	bndlEntry = getBundleEntryWithDefaults(bndlEntry)
	prevLastIndex := uint64(len(txs))
	lastIndex := uint64(len(txs)-1) + bndlEntry.Length
	tag := PadTag(bndlEntry.Tag)

	// set new last index on existing txs
	for i := range txs {
		txs[i].LastIndex = lastIndex
	}

	var i uint64
	for ; i < bndlEntry.Length; i++ {
		var v int64
		if i == 0 {
			v = bndlEntry.Value
		}
		txs = append(txs, transaction.Transaction{
			Address: bndlEntry.Address,
			Value:   v, Tag: tag, ObsoleteTag: tag,
			CurrentIndex: prevLastIndex + i,
			LastIndex:    lastIndex, Timestamp: bndlEntry.Timestamp,
			SignatureMessageFragment: bndlEntry.SignatureMessageFragments[i],
			TrunkTransaction:         NullHashTrytes, BranchTransaction: NullHashTrytes,
			Bundle: NullHashTrytes, Nonce: NullNonceTrytes, Hash: NullHashTrytes,
		})
	}

	return txs
}
1312581
func (obj *Global) GetAppEntry(ctx context.Context, appID string) (*AppEntry, error) {
	result := &struct {
		Entry *AppEntry	`json:"qEntry"`
	} {}
	err := obj.rpc(ctx, "GetAppEntry", result, appID)
	return result.Entry, err 
}
732660
func (nDB *NetworkDB) UpdateEntry(tname, nid, key string, value []byte) error {
	nDB.Lock()
	if _, err := nDB.getEntry(tname, nid, key); err != nil {
		nDB.Unlock()
		return fmt.Errorf("cannot update entry as the entry in table %s with network id %s and key %s does not exist", tname, nid, key)
	}

	entry := &entry{
		ltime: nDB.tableClock.Increment(),
		node:  nDB.config.NodeID,
		value: value,
	}

	nDB.createOrUpdateEntry(nid, tname, key, entry)
	nDB.Unlock()

	if err := nDB.sendTableEvent(TableEventTypeUpdate, nid, tname, key, entry); err != nil {
		return fmt.Errorf("cannot send table update event: %v", err)
	}

	return nil
}
792773
func (r *RepoFile) Add(re ...*Entry) {
	r.Repositories = append(r.Repositories, re...)
}
973122
func (r *Store) GetEntry(key string) (Entry, bool) {
	args := *r
	n := len(args)
	for i := 0; i < n; i++ {
		if kv := args[i]; kv.Key == key {
			return kv, true
		}
	}

	return emptyEntry, false
}
1170624
func (acl *ACL) CreateEntry() (*Entry, error) {
	var e C.acl_entry_t
	rv, _ := C.acl_create_entry(&acl.a, &e)
	if rv < 0 {
		return nil, fmt.Errorf("unable to create entry")
	}
	return &Entry{e}, nil
}
567775
func (r *Store) GetEntry(key string) *Entry {
	args := *r
	n := len(args)
	for i := 0; i < n; i++ {
		kv := &args[i]
		if kv.Key == key {
			return kv
		}
	}

	return nil
}
1231756
func MakeEntry(d []byte, idx types.MessageIndex) *Entry {
	return &Entry{
		D:           d,
		streamIndex: idx,
	}
}
470244
func (nDB *NetworkDB) createOrUpdateEntry(nid, tname, key string, entry interface{}) (bool, bool) {
	_, okTable := nDB.indexes[byTable].Insert(fmt.Sprintf("/%s/%s/%s", tname, nid, key), entry)
	_, okNetwork := nDB.indexes[byNetwork].Insert(fmt.Sprintf("/%s/%s/%s", nid, tname, key), entry)
	if !okNetwork {
		// Add only if it is an insert not an update
		n, ok := nDB.networks[nDB.config.NodeID][nid]
		if ok {
			n.entriesNumber++
		}
	}
	return okTable, okNetwork
}
1159566
func (b *GCSBuilder) AddEntries(data [][]byte) *GCSBuilder {
	// Do nothing if the builder's already errored out.
	if b.err != nil {
		return b
	}

	for _, entry := range data {
		b.AddEntry(entry)
	}
	return b
}
704644
func (a *ACL) AddBaseEntries(path string) error {
	fi, err := os.Lstat(path)
	if err != nil {
		return err
	}
	mode := fi.Mode().Perm()
	var r, w, x bool

	// set USER_OBJ entry
	r = mode&userRead == userRead
	w = mode&userWrite == userWrite
	x = mode&userExec == userExec
	if err := a.addBaseEntryFromMode(TagUserObj, r, w, x); err != nil {
		return err
	}

	// set GROUP_OBJ entry
	r = mode&groupRead == groupRead
	w = mode&groupWrite == groupWrite
	x = mode&groupExec == groupExec
	if err := a.addBaseEntryFromMode(TagGroupObj, r, w, x); err != nil {
		return err
	}

	// set OTHER entry
	r = mode&otherRead == otherRead
	w = mode&otherWrite == otherWrite
	x = mode&otherExec == otherExec
	if err := a.addBaseEntryFromMode(TagOther, r, w, x); err != nil {
		return err
	}

	return nil
}
1031789
func ReadCodeEntry(r io.Reader) (*module.CodeEntry, error) {

	wr := &reader{r: r, n: 0}
	entry, err := readCodeEntry(wr)
	if err != nil {
		return nil, errors.Wrapf(err, "offset 0x%x", wr.n)
	}

	return entry, nil
}
1372564
func (s *Service) AddLogEntry(ctx context.Context, k, v []byte, t time.Time) error {
	return s.kv.Update(ctx, func(tx Tx) error {
		return s.addLogEntry(ctx, tx, k, v, t)
	})
}
1246122
func (n *Name) AddTextEntry(field, value string) error {
	cfield := C.CString(field)
	defer C.free(unsafe.Pointer(cfield))
	cvalue := (*C.uchar)(unsafe.Pointer(C.CString(value)))
	defer C.free(unsafe.Pointer(cvalue))
	ret := C.X509_NAME_add_entry_by_txt(
		n.name, cfield, C.MBSTRING_ASC, cvalue, -1, -1, 0)
	if ret != 1 {
		return errors.New("failed to add x509 name text entry")
	}
	return nil
}
757804
func (acl *ACL) NextEntry() *Entry {
	var e C.acl_entry_t
	rv, _ := C.acl_get_entry(acl.a, C.ACL_NEXT_ENTRY, &e)
	if rv <= 0 {
		// either error obtaining entry or no more entries
		return nil
	}
	return &Entry{e}
}
838819
func ComposeEntryReveal(e *Entry) (*JSON2Request, error) {
	p, err := e.MarshalBinary()
	if err != nil {
		return nil, err
	}

	params := entryRequest{Entry: hex.EncodeToString(p)}
	req := NewJSON2Request("reveal-entry", APICounter(), params)

	return req, nil
}
571718
func (dd *DirData) AddEntry(
	ctx context.Context, newName string, newDe DirEntry) (
	unrefs []BlockInfo, err error) {
	return dd.addEntryHelper(ctx, newName, newDe, true, false)
}