How to use Next method of internal Package

Best Ginkgo code snippet using internal.Next

map.go

Source:map.go Github

copy

Full Screen

...491		return fmt.Errorf("delete failed: %w", err)492	}493	return nil494}495// NextKey finds the key following an initial key.496//497// See NextKeyBytes for details.498//499// Returns ErrKeyNotExist if there is no next key.500func (m *Map) NextKey(key, nextKeyOut interface{}) error {501	nextKeyPtr, nextKeyBytes := makeBuffer(nextKeyOut, int(m.keySize))502	if err := m.nextKey(key, nextKeyPtr); err != nil {503		return err504	}505	if err := m.unmarshalKey(nextKeyOut, nextKeyBytes); err != nil {506		return fmt.Errorf("can't unmarshal next key: %w", err)507	}508	return nil509}510// NextKeyBytes returns the key following an initial key as a byte slice.511//512// Passing nil will return the first key.513//514// Use Iterate if you want to traverse all entries in the map.515//516// Returns nil if there are no more keys.517func (m *Map) NextKeyBytes(key interface{}) ([]byte, error) {518	nextKey := make([]byte, m.keySize)519	nextKeyPtr := internal.NewSlicePointer(nextKey)520	err := m.nextKey(key, nextKeyPtr)521	if errors.Is(err, ErrKeyNotExist) {522		return nil, nil523	}524	return nextKey, err525}526func (m *Map) nextKey(key interface{}, nextKeyOut internal.Pointer) error {527	var (528		keyPtr internal.Pointer529		err    error530	)531	if key != nil {532		keyPtr, err = m.marshalKey(key)533		if err != nil {534			return fmt.Errorf("can't marshal key: %w", err)535		}536	}537	if err = bpfMapGetNextKey(m.fd, keyPtr, nextKeyOut); err != nil {538		return fmt.Errorf("next key failed: %w", err)539	}540	return nil541}542// BatchLookup looks up many elements in a map at once.543//544// "keysOut" and "valuesOut" must be of type slice, a pointer545// to a slice or buffer will not work.546// "prevKey" is the key to start the batch lookup from, it will547// *not* be included in the results. Use nil to start at the first key.548//549// ErrKeyNotExist is returned when the batch lookup has reached550// the end of all possible results, even when partial results551// are returned. It should be used to evaluate when lookup is "done".552func (m *Map) BatchLookup(prevKey, nextKeyOut, keysOut, valuesOut interface{}, opts *BatchOptions) (int, error) {553	return m.batchLookup(internal.BPF_MAP_LOOKUP_BATCH, prevKey, nextKeyOut, keysOut, valuesOut, opts)554}555// BatchLookupAndDelete looks up many elements in a map at once,556//557// It then deletes all those elements.558// "keysOut" and "valuesOut" must be of type slice, a pointer559// to a slice or buffer will not work.560// "prevKey" is the key to start the batch lookup from, it will561// *not* be included in the results. Use nil to start at the first key.562//563// ErrKeyNotExist is returned when the batch lookup has reached564// the end of all possible results, even when partial results565// are returned. It should be used to evaluate when lookup is "done".566func (m *Map) BatchLookupAndDelete(prevKey, nextKeyOut, keysOut, valuesOut interface{}, opts *BatchOptions) (int, error) {567	return m.batchLookup(internal.BPF_MAP_LOOKUP_AND_DELETE_BATCH, prevKey, nextKeyOut, keysOut, valuesOut, opts)568}569func (m *Map) batchLookup(cmd internal.BPFCmd, startKey, nextKeyOut, keysOut, valuesOut interface{}, opts *BatchOptions) (int, error) {570	if err := haveBatchAPI(); err != nil {571		return 0, err572	}573	if m.typ.hasPerCPUValue() {574		return 0, ErrNotSupported575	}576	keysValue := reflect.ValueOf(keysOut)577	if keysValue.Kind() != reflect.Slice {578		return 0, fmt.Errorf("keys must be a slice")579	}580	valuesValue := reflect.ValueOf(valuesOut)581	if valuesValue.Kind() != reflect.Slice {582		return 0, fmt.Errorf("valuesOut must be a slice")583	}584	count := keysValue.Len()585	if count != valuesValue.Len() {586		return 0, fmt.Errorf("keysOut and valuesOut must be the same length")587	}588	keyBuf := make([]byte, count*int(m.keySize))589	keyPtr := internal.NewSlicePointer(keyBuf)590	valueBuf := make([]byte, count*int(m.fullValueSize))591	valuePtr := internal.NewSlicePointer(valueBuf)592	var (593		startPtr internal.Pointer594		err      error595		retErr   error596	)597	if startKey != nil {598		startPtr, err = marshalPtr(startKey, int(m.keySize))599		if err != nil {600			return 0, err601		}602	}603	nextPtr, nextBuf := makeBuffer(nextKeyOut, int(m.keySize))604	ct, err := bpfMapBatch(cmd, m.fd, startPtr, nextPtr, keyPtr, valuePtr, uint32(count), opts)605	if err != nil {606		if !errors.Is(err, ErrKeyNotExist) {607			return 0, err608		}609		retErr = ErrKeyNotExist610	}611	err = m.unmarshalKey(nextKeyOut, nextBuf)612	if err != nil {613		return 0, err614	}615	err = unmarshalBytes(keysOut, keyBuf)616	if err != nil {617		return 0, err618	}619	err = unmarshalBytes(valuesOut, valueBuf)620	if err != nil {621		retErr = err622	}623	return int(ct), retErr624}625// BatchUpdate updates the map with multiple keys and values626// simultaneously.627// "keys" and "values" must be of type slice, a pointer628// to a slice or buffer will not work.629func (m *Map) BatchUpdate(keys, values interface{}, opts *BatchOptions) (int, error) {630	if err := haveBatchAPI(); err != nil {631		return 0, err632	}633	if m.typ.hasPerCPUValue() {634		return 0, ErrNotSupported635	}636	keysValue := reflect.ValueOf(keys)637	if keysValue.Kind() != reflect.Slice {638		return 0, fmt.Errorf("keys must be a slice")639	}640	valuesValue := reflect.ValueOf(values)641	if valuesValue.Kind() != reflect.Slice {642		return 0, fmt.Errorf("values must be a slice")643	}644	var (645		count    = keysValue.Len()646		valuePtr internal.Pointer647		err      error648	)649	if count != valuesValue.Len() {650		return 0, fmt.Errorf("keys and values must be the same length")651	}652	keyPtr, err := marshalPtr(keys, count*int(m.keySize))653	if err != nil {654		return 0, err655	}656	valuePtr, err = marshalPtr(values, count*int(m.valueSize))657	if err != nil {658		return 0, err659	}660	var nilPtr internal.Pointer661	ct, err := bpfMapBatch(internal.BPF_MAP_UPDATE_BATCH, m.fd, nilPtr, nilPtr, keyPtr, valuePtr, uint32(count), opts)662	return int(ct), err663}664// BatchDelete batch deletes entries in the map by keys.665// "keys" must be of type slice, a pointer to a slice or buffer will not work.666func (m *Map) BatchDelete(keys interface{}, opts *BatchOptions) (int, error) {667	if err := haveBatchAPI(); err != nil {668		return 0, err669	}670	if m.typ.hasPerCPUValue() {671		return 0, ErrNotSupported672	}673	keysValue := reflect.ValueOf(keys)674	if keysValue.Kind() != reflect.Slice {675		return 0, fmt.Errorf("keys must be a slice")676	}677	count := keysValue.Len()678	keyPtr, err := marshalPtr(keys, count*int(m.keySize))679	if err != nil {680		return 0, fmt.Errorf("cannot marshal keys: %v", err)681	}682	var nilPtr internal.Pointer683	ct, err := bpfMapBatch(internal.BPF_MAP_DELETE_BATCH, m.fd, nilPtr, nilPtr, keyPtr, nilPtr, uint32(count), opts)684	return int(ct), err685}686// Iterate traverses a map.687//688// It's safe to create multiple iterators at the same time.689//690// It's not possible to guarantee that all keys in a map will be691// returned if there are concurrent modifications to the map.692func (m *Map) Iterate() *MapIterator {693	return newMapIterator(m)694}695// Close removes a Map696func (m *Map) Close() error {697	if m == nil {698		// This makes it easier to clean up when iterating maps699		// of maps / programs.700		return nil701	}702	return m.fd.Close()703}704// FD gets the file descriptor of the Map.705//706// Calling this function is invalid after Close has been called.707func (m *Map) FD() int {708	fd, err := m.fd.Value()709	if err != nil {710		// Best effort: -1 is the number most likely to be an711		// invalid file descriptor.712		return -1713	}714	return int(fd)715}716// Clone creates a duplicate of the Map.717//718// Closing the duplicate does not affect the original, and vice versa.719// Changes made to the map are reflected by both instances however.720// If the original map was pinned, the cloned map will not be pinned by default.721//722// Cloning a nil Map returns nil.723func (m *Map) Clone() (*Map, error) {724	if m == nil {725		return nil, nil726	}727	dup, err := m.fd.Dup()728	if err != nil {729		return nil, fmt.Errorf("can't clone map: %w", err)730	}731	return &Map{732		m.name,733		dup,734		m.typ,735		m.keySize,736		m.valueSize,737		m.maxEntries,738		m.flags,739		"",740		m.fullValueSize,741	}, nil742}743// Pin persists the map on the BPF virtual file system past the lifetime of744// the process that created it .745//746// Calling Pin on a previously pinned map will overwrite the path, except when747// the new path already exists. Re-pinning across filesystems is not supported.748// You can Clone a map to pin it to a different path.749//750// This requires bpffs to be mounted above fileName. See https://docs.cilium.io/en/k8s-doc/admin/#admin-mount-bpffs751func (m *Map) Pin(fileName string) error {752	if err := internal.Pin(m.pinnedPath, fileName, m.fd); err != nil {753		return err754	}755	m.pinnedPath = fileName756	return nil757}758// Unpin removes the persisted state for the map from the BPF virtual filesystem.759//760// Failed calls to Unpin will not alter the state returned by IsPinned.761//762// Unpinning an unpinned Map returns nil.763func (m *Map) Unpin() error {764	if err := internal.Unpin(m.pinnedPath); err != nil {765		return err766	}767	m.pinnedPath = ""768	return nil769}770// IsPinned returns true if the map has a non-empty pinned path.771func (m *Map) IsPinned() bool {772	return m.pinnedPath != ""773}774// Freeze prevents a map to be modified from user space.775//776// It makes no changes to kernel-side restrictions.777func (m *Map) Freeze() error {778	if err := haveMapMutabilityModifiers(); err != nil {779		return fmt.Errorf("can't freeze map: %w", err)780	}781	if err := bpfMapFreeze(m.fd); err != nil {782		return fmt.Errorf("can't freeze map: %w", err)783	}784	return nil785}786// finalize populates the Map according to the Contents specified787// in spec and freezes the Map if requested by spec.788func (m *Map) finalize(spec *MapSpec) error {789	for _, kv := range spec.Contents {790		if err := m.Put(kv.Key, kv.Value); err != nil {791			return fmt.Errorf("putting value: key %v: %w", kv.Key, err)792		}793	}794	if spec.Freeze {795		if err := m.Freeze(); err != nil {796			return fmt.Errorf("freezing map: %w", err)797		}798	}799	return nil800}801func (m *Map) marshalKey(data interface{}) (internal.Pointer, error) {802	if data == nil {803		if m.keySize == 0 {804			// Queues have a key length of zero, so passing nil here is valid.805			return internal.NewPointer(nil), nil806		}807		return internal.Pointer{}, errors.New("can't use nil as key of map")808	}809	return marshalPtr(data, int(m.keySize))810}811func (m *Map) unmarshalKey(data interface{}, buf []byte) error {812	if buf == nil {813		// This is from a makeBuffer call, nothing do do here.814		return nil815	}816	return unmarshalBytes(data, buf)817}818func (m *Map) marshalValue(data interface{}) (internal.Pointer, error) {819	if m.typ.hasPerCPUValue() {820		return marshalPerCPUValue(data, int(m.valueSize))821	}822	var (823		buf []byte824		err error825	)826	switch value := data.(type) {827	case *Map:828		if !m.typ.canStoreMap() {829			return internal.Pointer{}, fmt.Errorf("can't store map in %s", m.typ)830		}831		buf, err = marshalMap(value, int(m.valueSize))832	case *Program:833		if !m.typ.canStoreProgram() {834			return internal.Pointer{}, fmt.Errorf("can't store program in %s", m.typ)835		}836		buf, err = marshalProgram(value, int(m.valueSize))837	default:838		return marshalPtr(data, int(m.valueSize))839	}840	if err != nil {841		return internal.Pointer{}, err842	}843	return internal.NewSlicePointer(buf), nil844}845func (m *Map) unmarshalValue(value interface{}, buf []byte) error {846	if buf == nil {847		// This is from a makeBuffer call, nothing do do here.848		return nil849	}850	if m.typ.hasPerCPUValue() {851		return unmarshalPerCPUValue(value, int(m.valueSize), buf)852	}853	switch value := value.(type) {854	case **Map:855		if !m.typ.canStoreMap() {856			return fmt.Errorf("can't read a map from %s", m.typ)857		}858		other, err := unmarshalMap(buf)859		if err != nil {860			return err861		}862		// The caller might close the map externally, so ignore errors.863		_ = (*value).Close()864		*value = other865		return nil866	case *Map:867		if !m.typ.canStoreMap() {868			return fmt.Errorf("can't read a map from %s", m.typ)869		}870		return errors.New("require pointer to *Map")871	case **Program:872		if !m.typ.canStoreProgram() {873			return fmt.Errorf("can't read a program from %s", m.typ)874		}875		other, err := unmarshalProgram(buf)876		if err != nil {877			return err878		}879		// The caller might close the program externally, so ignore errors.880		_ = (*value).Close()881		*value = other882		return nil883	case *Program:884		if !m.typ.canStoreProgram() {885			return fmt.Errorf("can't read a program from %s", m.typ)886		}887		return errors.New("require pointer to *Program")888	}889	return unmarshalBytes(value, buf)890}891// LoadPinnedMap loads a Map from a BPF file.892func LoadPinnedMap(fileName string, opts *LoadPinOptions) (*Map, error) {893	fd, err := internal.BPFObjGet(fileName, opts.Marshal())894	if err != nil {895		return nil, err896	}897	m, err := newMapFromFD(fd)898	if err == nil {899		m.pinnedPath = fileName900	}901	return m, err902}903// unmarshalMap creates a map from a map ID encoded in host endianness.904func unmarshalMap(buf []byte) (*Map, error) {905	if len(buf) != 4 {906		return nil, errors.New("map id requires 4 byte value")907	}908	id := internal.NativeEndian.Uint32(buf)909	return NewMapFromID(MapID(id))910}911// marshalMap marshals the fd of a map into a buffer in host endianness.912func marshalMap(m *Map, length int) ([]byte, error) {913	if length != 4 {914		return nil, fmt.Errorf("can't marshal map to %d bytes", length)915	}916	fd, err := m.fd.Value()917	if err != nil {918		return nil, err919	}920	buf := make([]byte, 4)921	internal.NativeEndian.PutUint32(buf, fd)922	return buf, nil923}924func patchValue(value []byte, typ btf.Type, replacements map[string]interface{}) error {925	replaced := make(map[string]bool)926	replace := func(name string, offset, size int, replacement interface{}) error {927		if offset+size > len(value) {928			return fmt.Errorf("%s: offset %d(+%d) is out of bounds", name, offset, size)929		}930		buf, err := marshalBytes(replacement, size)931		if err != nil {932			return fmt.Errorf("marshal %s: %w", name, err)933		}934		copy(value[offset:offset+size], buf)935		replaced[name] = true936		return nil937	}938	switch parent := typ.(type) {939	case *btf.Datasec:940		for _, secinfo := range parent.Vars {941			name := string(secinfo.Type.(*btf.Var).Name)942			replacement, ok := replacements[name]943			if !ok {944				continue945			}946			err := replace(name, int(secinfo.Offset), int(secinfo.Size), replacement)947			if err != nil {948				return err949			}950		}951	default:952		return fmt.Errorf("patching %T is not supported", typ)953	}954	if len(replaced) == len(replacements) {955		return nil956	}957	var missing []string958	for name := range replacements {959		if !replaced[name] {960			missing = append(missing, name)961		}962	}963	if len(missing) == 1 {964		return fmt.Errorf("unknown field: %s", missing[0])965	}966	return fmt.Errorf("unknown fields: %s", strings.Join(missing, ","))967}968// MapIterator iterates a Map.969//970// See Map.Iterate.971type MapIterator struct {972	target            *Map973	prevKey           interface{}974	prevBytes         []byte975	count, maxEntries uint32976	done              bool977	err               error978}979func newMapIterator(target *Map) *MapIterator {980	return &MapIterator{981		target:     target,982		maxEntries: target.maxEntries,983		prevBytes:  make([]byte, target.keySize),984	}985}986// Next decodes the next key and value.987//988// Iterating a hash map from which keys are being deleted is not989// safe. You may see the same key multiple times. Iteration may990// also abort with an error, see IsIterationAborted.991//992// Returns false if there are no more entries. You must check993// the result of Err afterwards.994//995// See Map.Get for further caveats around valueOut.996func (mi *MapIterator) Next(keyOut, valueOut interface{}) bool {997	if mi.err != nil || mi.done {998		return false999	}1000	// For array-like maps NextKeyBytes returns nil only on after maxEntries1001	// iterations.1002	for mi.count <= mi.maxEntries {1003		var nextBytes []byte1004		nextBytes, mi.err = mi.target.NextKeyBytes(mi.prevKey)1005		if mi.err != nil {1006			return false1007		}1008		if nextBytes == nil {1009			mi.done = true1010			return false1011		}1012		// The user can get access to nextBytes since unmarshalBytes1013		// does not copy when unmarshaling into a []byte.1014		// Make a copy to prevent accidental corruption of1015		// iterator state.1016		copy(mi.prevBytes, nextBytes)1017		mi.prevKey = mi.prevBytes1018		mi.count++1019		mi.err = mi.target.Lookup(nextBytes, valueOut)1020		if errors.Is(mi.err, ErrKeyNotExist) {1021			// Even though the key should be valid, we couldn't look up1022			// its value. If we're iterating a hash map this is probably1023			// because a concurrent delete removed the value before we1024			// could get it. This means that the next call to NextKeyBytes1025			// is very likely to restart iteration.1026			// If we're iterating one of the fd maps like1027			// ProgramArray it means that a given slot doesn't have1028			// a valid fd associated. It's OK to continue to the next slot.1029			continue1030		}1031		if mi.err != nil {1032			return false1033		}1034		mi.err = mi.target.unmarshalKey(keyOut, nextBytes)1035		return mi.err == nil1036	}1037	mi.err = fmt.Errorf("%w", ErrIterationAborted)1038	return false1039}1040// Err returns any encountered error.1041//1042// The method must be called after Next returns nil.1043//1044// Returns ErrIterationAborted if it wasn't possible to do a full iteration.1045func (mi *MapIterator) Err() error {1046	return mi.err1047}1048// MapGetNextID returns the ID of the next eBPF map.1049//1050// Returns ErrNotExist, if there is no next eBPF map.1051func MapGetNextID(startID MapID) (MapID, error) {1052	id, err := objGetNextID(internal.BPF_MAP_GET_NEXT_ID, uint32(startID))1053	return MapID(id), err1054}1055// NewMapFromID returns the map for a given id.1056//1057// Returns ErrNotExist, if there is no eBPF map with the given id.1058func NewMapFromID(id MapID) (*Map, error) {1059	fd, err := internal.BPFObjGetFDByID(internal.BPF_MAP_GET_FD_BY_ID, uint32(id))1060	if err != nil {1061		return nil, err1062	}1063	return newMapFromFD(fd)1064}1065// ID returns the systemwide unique ID of the map.1066//...

Full Screen

Full Screen

internal_domain_federation_collection_response.go

Source:internal_domain_federation_collection_response.go Github

copy

Full Screen

1package models2import (3    i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"4)5// InternalDomainFederationCollectionResponse 6type InternalDomainFederationCollectionResponse struct {7    // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.8    additionalData map[string]interface{}9    // The nextLink property10    nextLink *string11    // The value property12    value []InternalDomainFederationable13}14// NewInternalDomainFederationCollectionResponse instantiates a new InternalDomainFederationCollectionResponse and sets the default values.15func NewInternalDomainFederationCollectionResponse()(*InternalDomainFederationCollectionResponse) {16    m := &InternalDomainFederationCollectionResponse{17    }18    m.SetAdditionalData(make(map[string]interface{}));19    return m20}21// CreateInternalDomainFederationCollectionResponseFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value22func CreateInternalDomainFederationCollectionResponseFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {23    return NewInternalDomainFederationCollectionResponse(), nil24}25// GetAdditionalData gets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.26func (m *InternalDomainFederationCollectionResponse) GetAdditionalData()(map[string]interface{}) {27    if m == nil {28        return nil29    } else {30        return m.additionalData31    }32}33// GetFieldDeserializers the deserialization information for the current model34func (m *InternalDomainFederationCollectionResponse) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {35    res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))36    res["@odata.nextLink"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {37        val, err := n.GetStringValue()38        if err != nil {39            return err40        }41        if val != nil {42            m.SetOdatanextLink(val)43        }44        return nil45    }46    res["value"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {47        val, err := n.GetCollectionOfObjectValues(CreateInternalDomainFederationFromDiscriminatorValue)48        if err != nil {49            return err50        }51        if val != nil {52            res := make([]InternalDomainFederationable, len(val))53            for i, v := range val {54                res[i] = v.(InternalDomainFederationable)55            }56            m.SetValue(res)57        }58        return nil59    }60    return res61}62// GetOdatanextLink gets the @odata.nextLink property value. The nextLink property63func (m *InternalDomainFederationCollectionResponse) GetOdatanextLink()(*string) {64    if m == nil {65        return nil66    } else {67        return m.nextLink68    }69}70// GetValue gets the value property value. The value property71func (m *InternalDomainFederationCollectionResponse) GetValue()([]InternalDomainFederationable) {72    if m == nil {73        return nil74    } else {75        return m.value76    }77}78// Serialize serializes information the current object79func (m *InternalDomainFederationCollectionResponse) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {80    {81        err := writer.WriteStringValue("@odata.nextLink", m.GetOdatanextLink())82        if err != nil {83            return err84        }85    }86    if m.GetValue() != nil {87        cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetValue()))88        for i, v := range m.GetValue() {89            cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)90        }91        err := writer.WriteCollectionOfObjectValues("value", cast)92        if err != nil {93            return err94        }95    }96    {97        err := writer.WriteAdditionalData(m.GetAdditionalData())98        if err != nil {99            return err100        }101    }102    return nil103}104// SetAdditionalData sets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.105func (m *InternalDomainFederationCollectionResponse) SetAdditionalData(value map[string]interface{})() {106    if m != nil {107        m.additionalData = value108    }109}110// SetOdatanextLink sets the @odata.nextLink property value. The nextLink property111func (m *InternalDomainFederationCollectionResponse) SetOdatanextLink(value *string)() {112    if m != nil {113        m.nextLink = value114    }115}116// SetValue sets the value property value. The value property117func (m *InternalDomainFederationCollectionResponse) SetValue(value []InternalDomainFederationable)() {118    if m != nil {119        m.value = value120    }121}...

Full Screen

Full Screen

internal_test.go

Source:internal_test.go Github

copy

Full Screen

2// of this source code is governed by a BSD-style license that can be found in3// the LICENSE file.4package pebble5// internalIterAdapter adapts the new internalIterator interface which returns6// the key and value from positioning methods (Seek*, First, Last, Next, Prev)7// to the old interface which returned a boolean corresponding to Valid. Only8// used by test code.9type internalIterAdapter struct {10	internalIterator11	key *InternalKey12	val []byte13}14func newInternalIterAdapter(iter internalIterator) *internalIterAdapter {15	return &internalIterAdapter{16		internalIterator: iter,17	}18}19func (i *internalIterAdapter) update(key *InternalKey, val []byte) bool {20	i.key = key21	i.val = val22	return i.key != nil23}24func (i *internalIterAdapter) String() string {25	return "internal-iter-adapter"26}27func (i *internalIterAdapter) SeekGE(key []byte) bool {28	return i.update(i.internalIterator.SeekGE(key))29}30func (i *internalIterAdapter) SeekPrefixGE(prefix, key []byte, trySeekUsingNext bool) bool {31	return i.update(i.internalIterator.SeekPrefixGE(prefix, key, trySeekUsingNext))32}33func (i *internalIterAdapter) SeekLT(key []byte) bool {34	return i.update(i.internalIterator.SeekLT(key))35}36func (i *internalIterAdapter) First() bool {37	return i.update(i.internalIterator.First())38}39func (i *internalIterAdapter) Last() bool {40	return i.update(i.internalIterator.Last())41}42func (i *internalIterAdapter) Next() bool {43	return i.update(i.internalIterator.Next())44}45func (i *internalIterAdapter) Prev() bool {46	return i.update(i.internalIterator.Prev())47}48func (i *internalIterAdapter) Key() *InternalKey {49	return i.key50}51func (i *internalIterAdapter) Value() []byte {52	return i.val53}54func (i *internalIterAdapter) Valid() bool {55	return i.key != nil56}...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Ginkgo automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful