You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: lbmap.go
    path of file: ./repos/hubble-ui/backend/vendor/github.com/cilium/cilium/pkg/datapath/types
    
    the code of the file until where you have to start completion: // SPDX-License-Identifier: Apache-2.0
// Copyright Authors of Cilium

package types

import (
	"net"
	"sort"

	"github.com/cilium/cilium/pkg/cidr"
	"github.com/cilium/cilium/pkg/loadbalancer"
)

// LBMap is the interface describing methods for manipulating service maps.
type LBMap interface {
	UpsertService(*UpsertServiceParams) error
	UpsertMaglevLookupTable(uint16, map[string]*loadbalancer.Backend, bool) error
	IsMaglevLookupTableRecreated(bool) bool
	DeleteService(loadbalancer.L3n4AddrID, int, bool, loadbalancer.SVCNatPolicy) error
	Ad
    
func (p *UpsertServiceParams) GetOrderedBackends() []loadbalancer.BackendID {
	backendIDs := make([]loadbalancer.BackendID, 0, len(p.ActiveBackends)+len(p.NonActiveBackends))
	for _, b := range p.ActiveBackends {
		backendIDs = append(backendIDs, b.ID)
	}

	preferredMap := map[loadbalancer.BackendID]struct{}{}
	for _, b := range p.PreferredBackends {
		preferredMap[b.ID] = struct{}{}
	}

	// Map iterations are non-deterministic so sort the backends by their IDs
	// in order to maintain the same order before they are populated in BPF maps.
	// This will minimize disruption to existing connections to the backends in the datapath.
	sort.Slice(backendIDs, func(i, j int) bool {
		// compare preferred flags of two backend IDs
		_, firstPreferred := preferredMap[backendIDs[i]]
		_, secondPreferred := preferredMap[backendIDs[j]]

		if firstPreferred && secondPreferred {
			return backendIDs[i] < backendIDs[j]
		}

		if firstPreferred {
			return true
		}

		if secondPreferred {
			return false
		}

		return backendIDs[i] < backendIDs[j]
	})

	// Add the non-active backends to the end of preferred/active backends list so that they are
	// not considered while selecting backends to load-balance service traffic.
	if len(p.NonActiveBackends) > 0 {
		backendIDs = append(backendIDs, p.NonActiveBackends...)
	}

	return backendIDs
}