telecomm

package
v0.0.0-...-f2d3015 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakePathway

func MakePathway(ctx model.SimContext, l2rByteDuration, r2lByteDuration time.Duration) (*Connection, *Connection)

Types

type ByteSchedule

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

ByteSchedule is a data structure reflecting an unlimited sequence of timestamped bytes. Each data item can be considered a 3-tuple of (start-time, end-time, byte-value). This sequence is *predicted*... that means that each data item does not become finalized until sim.Now() is strictly greater than the data item's start time.

Contract:

  1. New data items can only be added with start-times no earlier than sim.Now()
  2. Data items with start-times no earlier than sim.Now() may be deleted.
  3. Data items may never overlap, though end-time[n] = start-time[n+1] does not qualify as an overlap.
  4. Sequence changes (deletions, appends) may only occur on suffixes of the unlimited sequence. Changes may not be made in the middle.
  5. The recipient, however, may excise prefixes with end times no later than sim.Now(), as an optimization.

func MakeByteSchedule

func MakeByteSchedule(ctx model.SimContext) *ByteSchedule

func (*ByteSchedule) ClearBytes

func (cs *ByteSchedule) ClearBytes(startTime model.VirtualTime)

ClearBytes deletes a suffix of existing bytes. Any data items with start-times equal to or later than startTime will be removed from the sequence. startTime must be no earlier than sim.Now().

func (*ByteSchedule) FillBytes

func (cs *ByteSchedule) FillBytes(startTime model.VirtualTime, byteDuration time.Duration, bytes []byte)

FillBytes appends a suffix of additional bytes. Each byte is translated to a data item: (startTime + byteDuration * i, startTime + byteDuration * (i+1), byte[i]) startTime must be no earlier than sim.Now().

func (*ByteSchedule) LastEndTime

func (cs *ByteSchedule) LastEndTime() model.VirtualTime

LastEndTime determines the last transmission time of the final byte scheduled, or the current time, whichever is later.

func (*ByteSchedule) LookupEndTime

func (cs *ByteSchedule) LookupEndTime(nth int) model.VirtualTime

LookupEndTime determines the end time of the nth byte returned by PeekAllBytes()

func (*ByteSchedule) PeekAllBytes

func (cs *ByteSchedule) PeekAllBytes() (out []byte)

PeekAllBytes returns the complete sequence of bytes, including predicted bytes.

func (*ByteSchedule) ReceiveBytes

func (cs *ByteSchedule) ReceiveBytes(endTime model.VirtualTime) []byte

ReceiveBytes extracts the prefix of existing bytes that are finalized and returns them as a byte array.

type Connection

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

func (*Connection) ConsumeBytesUpTo

func (tc *Connection) ConsumeBytesUpTo(upto model.VirtualTime, count int)

func (*Connection) CountTxBytesRemaining

func (tc *Connection) CountTxBytesRemaining() (count int, remainingStartAt model.VirtualTime)

func (*Connection) LastEndTime

func (tc *Connection) LastEndTime() model.VirtualTime

func (*Connection) LookupEndTime

func (tc *Connection) LookupEndTime(nth int) model.VirtualTime

func (*Connection) PeekAllBytes

func (tc *Connection) PeekAllBytes() []byte

func (*Connection) PullBytesAvailable

func (tc *Connection) PullBytesAvailable() []byte

func (*Connection) Subscribe

func (tc *Connection) Subscribe(callback func()) (cancel func())

Subscribe to changes in the future transmission schedule

func (*Connection) UpdateTransmission

func (tc *Connection) UpdateTransmission(transmissionStart model.VirtualTime, newBytes []byte)

type ScheduleItem

type ScheduleItem struct {
	StartTime model.VirtualTime
	EndTime   model.VirtualTime
	Byte      byte
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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