loot

package
v1.15.16 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: GPL-3.0 Imports: 12 Imported by: 1

README

Loot

This packages implements the server's Loot interfaces and local storage backend.

Documentation

Index

Constants

View Source
const (
	// MaxLootSize - The maximum size of a loot file in bytes
	MaxLootSize = 2 * 1024 * 1024 * 1024 // 2Gb, shouldn't matter the gRPC message size limit is 2Gb
)

Variables

View Source
var (
	// ErrInvalidLootID - Invalid Loot ID
	ErrInvalidLootID = errors.New("invalid loot id")
	// ErrLootNotFound - Loot not found
	ErrLootNotFound = errors.New("loot not found")
)

Functions

func GetLootCredentialDir

func GetLootCredentialDir() string

GetLootCredentialDir - Get the subdirectory where loot credentials are stored

func GetLootDir

func GetLootDir() string

GetLootDir - Get the directory that contains all loot

func GetLootFileDir

func GetLootFileDir() string

GetLootFileDir - Get the subdirectory where loot files are stored

Types

type LocalBackend

type LocalBackend struct {
	LocalFileDir string
	LocalCredDir string
}

LocalBackend - A loot backend that saves files locally to disk

func (*LocalBackend) Add

func (l *LocalBackend) Add(loot *clientpb.Loot) (*clientpb.Loot, error)

Add - Add a piece of loot

func (*LocalBackend) All

func (l *LocalBackend) All() *clientpb.AllLoot

All - Get all loot

func (*LocalBackend) AllOf

func (l *LocalBackend) AllOf(lootType clientpb.LootType) *clientpb.AllLoot

AllOf - Get all loot of a particular loot type

func (*LocalBackend) GetContent

func (l *LocalBackend) GetContent(lootID string, eager bool) (*clientpb.Loot, error)

GetContent - Get the content of a piece of loot

func (*LocalBackend) Rm

func (l *LocalBackend) Rm(lootID string) error

Rm - Remove a piece of loot

func (*LocalBackend) Update

func (l *LocalBackend) Update(lootReq *clientpb.Loot) (*clientpb.Loot, error)

Update - Update metadata about loot, currently only 'name' can be changed

type LootBackend

type LootBackend interface {
	Add(*clientpb.Loot) (*clientpb.Loot, error)
	Rm(string) error
	Update(*clientpb.Loot) (*clientpb.Loot, error)
	GetContent(string, bool) (*clientpb.Loot, error)
	All() *clientpb.AllLoot
	AllOf(clientpb.LootType) *clientpb.AllLoot
}

LootBackend - The interface any loot backend must implement

type LootStore

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

LootStore - The struct that represents the loot store

func GetLootStore

func GetLootStore() *LootStore

GetLootStore - Get an instances of the core LootStore

func (*LootStore) Add

func (l *LootStore) Add(lootReq *clientpb.Loot) (*clientpb.Loot, error)

Add - Add a piece of loot to the loot store

func (*LootStore) All

func (l *LootStore) All() *clientpb.AllLoot

All - Get all loot from the loot store

func (*LootStore) AllOf

func (l *LootStore) AllOf(lootType clientpb.LootType) *clientpb.AllLoot

AllOf - Get loot of a particular type from the loot store

func (*LootStore) GetContent

func (l *LootStore) GetContent(lootID string, eager bool) (*clientpb.Loot, error)

GetContent - Get the content of a piece of loot from the loot store

func (*LootStore) Rm

func (l *LootStore) Rm(lootID string) error

Remove - Remove a piece of loot from the loot store

func (*LootStore) Update

func (l *LootStore) Update(lootReq *clientpb.Loot) (*clientpb.Loot, error)

Update - Update a piece of loot in the loot store

Jump to

Keyboard shortcuts

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