utils

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Atomic

type Atomic[T any] struct {
	// contains filtered or unexported fields
}

func (*Atomic[T]) CompareAndSwap

func (a *Atomic[T]) CompareAndSwap(old, new T) bool

func (*Atomic[T]) Load

func (a *Atomic[T]) Load() T

func (*Atomic[T]) Store

func (a *Atomic[T]) Store(value T)

func (*Atomic[T]) Swap

func (a *Atomic[T]) Swap(new T) T

type AtomicTime

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

func NewAtomicTime

func NewAtomicTime(t time.Time) *AtomicTime

func (*AtomicTime) Get

func (t *AtomicTime) Get() time.Time

func (*AtomicTime) Set

func (t *AtomicTime) Set(new time.Time)

type QStream

type QStream struct {
	Stream quic.Stream
}

QStream is a wrapper of quic.Stream that handles Close() in a way that makes more sense to us. By default, quic.Stream's Close() only closes the write side of the stream, not the read side. And if there is unread data, the stream is not really considered closed until either the data is drained or CancelRead() is called. References: - https://github.com/libp2p/go-libp2p/blob/master/p2p/transport/quic/stream.go - https://github.com/quic-go/quic-go/issues/3558 - https://github.com/quic-go/quic-go/issues/1599

func (*QStream) CancelRead

func (s *QStream) CancelRead(code quic.StreamErrorCode)

func (*QStream) CancelWrite

func (s *QStream) CancelWrite(code quic.StreamErrorCode)

func (*QStream) Close

func (s *QStream) Close() error

func (*QStream) Context

func (s *QStream) Context() context.Context

func (*QStream) Read

func (s *QStream) Read(p []byte) (n int, err error)

func (*QStream) SetDeadline

func (s *QStream) SetDeadline(t time.Time) error

func (*QStream) SetReadDeadline

func (s *QStream) SetReadDeadline(t time.Time) error

func (*QStream) SetWriteDeadline

func (s *QStream) SetWriteDeadline(t time.Time) error

func (*QStream) StreamID

func (s *QStream) StreamID() quic.StreamID

func (*QStream) Write

func (s *QStream) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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