stats

package
v0.0.0-...-2e4d9bc Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2021 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package stats is the Teonet room statistic functions and datbase themes.

Teoroom stats provide teroom database functions executed in cdb.

Install this go package:

go get github.com/kirill-scherba/teonet-go/services/teoroom/cdb

Data base organisation

To store database we use ScyllaDB. Run Scylla in Docker:

https://www.scylladb.com/download/open-source/#docker

Install database schemas. Before you execute application which used this service, launch `cqlsh`:

docker exec -it scylla cqlsh

and execute content of cql/teoroom.cql file.

For tests repeat the same instructions but use teoroom_test keyspace.

Index

Constants

This section is empty.

Variables

View Source
var MODULE = teokeys.Color(teokeys.ANSIBrown, "(teoroom-stat)")

MODULE is this package module name

Functions

This section is empty.

Types

type Client

type Client struct {
	RoomID       gocql.UUID // Room ID
	ID           gocql.UUID // ID
	Added        time.Time  // Time added
	Loadded      time.Time  // Time loadded
	Started      time.Time  // Time started
	Leave        time.Time  // Time leave
	Disconnected time.Time  // Time disconnected
	GameStat     []byte     // Game statistic
}

Client data structure

type Process

type Process struct{ *Rooms }

Process receiver to process teousers commands

func (*Process) ComClientStatus

func (p *Process) ComClientStatus(pac TeoPacket) (err error)

ComClientStatus process rooms client state changed command

func (*Process) ComGetRoomsByCreated

func (p *Process) ComGetRoomsByCreated(pac TeoPacket) (rooms []stats.Room,
	err error)

ComGetRoomsByCreated get rooms request by Created, read data from database and return answer to request

func (*Process) ComRoomCreated

func (p *Process) ComRoomCreated(pac TeoPacket) (err error)

ComRoomCreated process setCreating, return room uuid.

Input data (binary): room_num uint32.

Output data (byte): id gocql.uuid

func (*Process) ComRoomStateChanged

func (p *Process) ComRoomStateChanged(pac TeoPacket) (err error)

ComRoomStateChanged process state changed command

type Rooms

type Rooms struct {
	*Process
	stats.TeoConnector
	// contains filtered or unexported fields
}

Rooms is the teoroomcdb data structure and methods receiver

func Connect

func Connect(con stats.TeoConnector, hosts ...string) (r *Rooms, err error)

Connect to the cql cluster and create teoroomcdb receiver. First parameter is keyspace, next parameters is hosts name (usualy it should be 3 hosts - 3 ScyllaDB nodes)

func (*Rooms) Close

func (r *Rooms) Close()

Close closes cql connection and destroy teoregistry receiver

type TeoPacket

type TeoPacket interface {
	Cmd() byte
	Data() []byte
}

TeoPacket is teonet packet interface

Jump to

Keyboard shortcuts

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