diff options
author | pg9182 <96569817+pg9182@users.noreply.github.com> | 2022-10-12 23:55:00 -0400 |
---|---|---|
committer | pg9182 <96569817+pg9182@users.noreply.github.com> | 2022-10-12 23:55:00 -0400 |
commit | cfb0debaed3a1ee191dd3d41c84a2ccdf3df65b7 (patch) | |
tree | c7b2be287e8fcb1413eb3bc086a9f3fa1a6ca627 /pkg/api/api0/storage.go | |
parent | b204d86a0a623b3636c7fbafb59a42e3d12a82c7 (diff) | |
download | Atlas-cfb0debaed3a1ee191dd3d41c84a2ccdf3df65b7.tar.gz Atlas-cfb0debaed3a1ee191dd3d41c84a2ccdf3df65b7.zip |
pkg/api/api0: Add pdata storage interface
Diffstat (limited to 'pkg/api/api0/storage.go')
-rw-r--r-- | pkg/api/api0/storage.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/pkg/api/api0/storage.go b/pkg/api/api0/storage.go new file mode 100644 index 0000000..cf7b078 --- /dev/null +++ b/pkg/api/api0/storage.go @@ -0,0 +1,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) +} |