drsm

package module
v0.0.72-dev Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

README

drsm

Distributed Resource Sharing Module (DRSM)

Resources can be - integer numbers (TEID, SEID, NGAPIDs,TMSI,...) - IP address pool

Modes - demux mode : just listen and get mapping about PODS and their resource assignments * can be used by sctplb, upf-adapter - client mode : Learn about other clients and their resource mappings * can be used by AMF pods, SMF pod

Dependency - MongoDB should run in cluster(replicaset) Mode or sharded Mode

Limitation: - MongoDBlib keeps global client variable. So only 1 DB connection and 1 database allowed. - We can not have multiple Database connections with above limitation.

Testing - All the DRSM clients discover other clients through pub/sub - Allocate resource id ( indirectly chunk). Other Pods should get notification of newly allocated chunk - POD down event should be detected - Get candidate ORPHAN chunk list once POD down detected - CLAIM chunk to change owner - Through notification other PODS should detect if CHUNK is claimed - Run large number of clients and bring down replicaset by 1..All other pod would try to claim chunks of crashed pod. we should see only 1 client claiming it successfully - If some pod is started late and already there are number of documents in collections. Then does stream provide old docs as well ? No. Added code to read existing docs. - Multiple Pods trying to allocate same Chunkid. dbInsert only succeeds for one client. Does DRSM handle error and retry other Chunk - Clear Separation of demux API vs regular CLIENT API - Callback should be available where chunk scanning (resource id usage) can be done with help of application - Pod identity is IP address + Pod Name - Allocate more than 1000 ids.. See if New chunk is allocated

TODO: - Release Id test - IP address allocation - MongoDB instance restart - Rst counter to be appended to identify pod.PodId should be = K8s Pod Id + Rst Count. This makes sure that restarted pod even if it comes with same name then we treat it differently - min REST APIs to trigger { allocate, claim }

Documentation

Index

Constants

View Source
const (
	Invalid chunkState = iota + 1
	Owned
	PeerOwned
	Orphan
	Scanning
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DbInfo

type DbInfo struct {
	Url  string
	Name string
}

type DocKey

type DocKey struct {
	Id string `bson:"_id,omitempty"`
}

type Drsm

type Drsm struct {
	// contains filtered or unexported fields
}

func InitDRSM

func InitDRSM(sharedPoolName string, myid PodId, db DbInfo, opt *Options) (*Drsm, error)

func (*Drsm) AcquireIp

func (d *Drsm) AcquireIp(pool string) (string, error)

func (*Drsm) AllocateInt32ID

func (d *Drsm) AllocateInt32ID() (int32, error)

func (*Drsm) ConstuctDrsm

func (d *Drsm) ConstuctDrsm(opt *Options)

func (*Drsm) FindOwnerInt32ID

func (d *Drsm) FindOwnerInt32ID(id int32) (*PodId, error)

func (*Drsm) GetNewChunk

func (d *Drsm) GetNewChunk() (*chunk, error)

func (*Drsm) ReleaseInt32ID

func (d *Drsm) ReleaseInt32ID(id int32) error

func (*Drsm) ReleaseIp

func (d *Drsm) ReleaseIp(pool, ip string) error

type DrsmMode

type DrsmMode int
const (
	ResourceClient DrsmMode = iota + 0
	ResourceDemux
)

type FullStream

type FullStream struct {
	Id       string    `bson:"_id,omitempty"`
	PodId    string    `bson:"podId,omitempty"`
	PodIp    string    `bson:"podIp,omitempty"`
	ExpireAt time.Time `bson:"expireAt,omitempty"`
	Type     string    `bson:"type,omitempty"`
}

type Options

type Options struct {
	ResIdSize       int32 //size in bits e.g. 32 bit, 24 bit.
	Mode            DrsmMode
	ResourceValidCb func(int32) bool // return if ID is in use or not used
	IpPool          map[string]string
}

type PodId

type PodId struct {
	PodName string `bson:"podName,omitempty" json:"podName,omitempty"`
	PodIp   string `bson:"podIp,omitempty" json:"podIp,omitempty"`
}

type UpdatedDesc

type UpdatedDesc struct {
	UpdFields UpdatedFields `bson:"updatedFields,omitempty"`
}

type UpdatedFields

type UpdatedFields struct {
	ExpireAt time.Time `bson:"expireAt,omitempty"`
	PodId    string    `bson:"podId,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL