aboutsummaryrefslogtreecommitdiff
path: root/pkg/api/api0/storage.go
blob: cf7b078f834369db9ba992a5f5e1b920dc2c8d36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package api0

import "crypto/sha256"

// PdataStorage stores player data for users. It should not make any assumptions
// on the contents of the stored blobs (including validity). It may compress the
// stored data. It must be safe for concurrent use.
type PdataStorage interface {
	// GetPdataCached gets the pdata for uid. If there is not any pdata for uid,
	// ok is false. If the provided hash is nonzero and the current pdata
	// matches, buf is nil. If another error occurs, buf is nil, ok is false,
	// and err is non-nil.
	GetPdataCached(uid uint64, sha256 [sha256.Size]byte) (buf []byte, exists bool, err error)

	// SetPdata sets the raw pdata for uid.
	SetPdata(uid uint64, buf []byte) (err error)
}