empty

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSessionEnd

func GetSessionEnd(sessionId, startBlock uint64, sessionType types.SessionType) uint64

GetSessionEnd returns session end based on: sessionId - current session id, startBlock - block where the first session started, sessionType - type of the session. Example: Lets take duration = 23 blocks and start = 10 block. So first three session will be on 10-33 34-57 58-81 blocks end = id*24 + start - 1 id = 1 => end = 1 * 24 + 10 - 1 = 33 id = 2 => end = 2 * 24 + 10 - 1 = 57 id = 3 => end = 3 * 24 + 10 - 1 = 81

func GetSessionId

func GetSessionId(current, startId, startBlock uint64, sessionType types.SessionType) uint64

GetSessionId returns current session id based on: startId - session id to start from, startBlock - block where session with startId started, current - current block, sessionType - type of the session. Example: Lets take duration = 23 blocks and start = 10 block. So first three session will be on 10-33 34-57 58-81 blocks id = (current - start) / 24 + 1 current = 10 => id = (10 - 10) / 24 + 1 = 1 current = 33 => id = (33 - 10) / 24 + 1 = 1 current = 34 => id = (34 - 10) / 24 + 1 = 1 + 1 = 1

Types

type Session

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

func NewEmptySession

func NewEmptySession(ctx core.Context, info *config.SessionInfo, sessionType types.SessionType, creator func(ctx core.Context, id, startBlock uint64) core.ISession) *Session

func (*Session) End

func (s *Session) End() uint64

func (*Session) ID

func (s *Session) ID() uint64

func (*Session) NewBlock

func (s *Session) NewBlock(height uint64)

func (*Session) NextSession

func (s *Session) NextSession() core.ISession

func (*Session) Receive

Jump to

Keyboard shortcuts

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