playerindices

package
v0.3.3-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package playerindices indexes player attributes in Redis for faster filtering of player pools.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (

	// OM Internal metadata indices
	MetaIndices = []string{
		"OM_METADATA.created",
		"OM_METADATA.accessed",
	}
)

Functions

func Create

func Create(ctx context.Context, rPool *redis.Pool, cfg *viper.Viper, player om_messages.Player) error

Create indices for given player attributes in Redis. TODO: make this quit and not index the player if the context is cancelled.

func Delete

func Delete(ctx context.Context, rPool *redis.Pool, cfg *viper.Viper, playerID string) error

Delete a player's indices without deleting their JSON object representation from state storage. Note: In Open Match, it is best practice to 'lazily' remove indices by running this as a goroutine. TODO: make this quit cleanly if the context is cancelled.

func DeleteMeta

func DeleteMeta(ctx context.Context, rPool *redis.Pool, playerID string)

DeleteMeta removes a player's internal Open Match metadata indices, and should only be used after deleting their JSON object representation from state storage. Note: In Open Match, it is best practice to 'lazily' remove indices by running this as a goroutine. TODO: make this quit cleanly if the context is cancelled.

func Retrieve

func Retrieve(cfg *viper.Viper) (indices []string, err error)

Retrieve pulls the player indices from the Viper config

func RetrievePrevious

func RetrievePrevious(cfg *viper.Viper) []string

RetrievePrevious attempts to handle an edge case when the user has removed an index from the list of player indices but players still exist who are indexed using the (now no longer used) index. The user should put the index they are no longer using into this config parameter so that deleting players with previous indexes doesn't result in a Redis memory leak. In a future version, Open Match should track previous indices itself and handle this for the user.

func Touch

func Touch(ctx context.Context, rPool *redis.Pool, playerID string) error

Touch is analogous to the Unix touch command. It updates the accessed time of the player in the OM_METADATA.accessed index to the current epoch timestamp.

Types

This section is empty.

Jump to

Keyboard shortcuts

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