2022-03-12 16:15:26 +00:00
|
|
|
/*
|
2022-12-29 10:46:18 +00:00
|
|
|
Package accounting provides primitives to perform accounting operations in FrostFS.
|
2022-03-12 16:15:26 +00:00
|
|
|
|
|
|
|
Decimal type provides functionality to process user balances. For example, when
|
|
|
|
working with Fixed8 balance precision:
|
2022-08-24 14:17:40 +00:00
|
|
|
|
2022-03-12 16:15:26 +00:00
|
|
|
var dec accounting.Decimal
|
|
|
|
dec.SetValue(val)
|
|
|
|
dec.SetPrecision(8)
|
|
|
|
|
2022-12-29 10:46:18 +00:00
|
|
|
Instances can be also used to process FrostFS API V2 protocol messages
|
2023-03-07 11:20:03 +00:00
|
|
|
(see neo.fs.v2.accounting package in https://git.frostfs.info/TrueCloudLab/frostfs-api).
|
2022-03-12 16:15:26 +00:00
|
|
|
|
|
|
|
On client side:
|
2022-08-24 14:17:40 +00:00
|
|
|
|
2023-03-07 11:20:03 +00:00
|
|
|
import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting"
|
2022-03-12 16:15:26 +00:00
|
|
|
|
|
|
|
var msg accounting.Decimal
|
2022-03-17 13:45:26 +00:00
|
|
|
dec.WriteToV2(&msg)
|
2022-03-12 16:15:26 +00:00
|
|
|
|
|
|
|
// send msg
|
|
|
|
|
|
|
|
On server side:
|
2022-08-24 14:17:40 +00:00
|
|
|
|
2022-03-12 16:15:26 +00:00
|
|
|
// recv msg
|
|
|
|
|
|
|
|
var dec accounting.Decimal
|
2022-03-17 13:45:26 +00:00
|
|
|
dec.ReadFromV2(msg)
|
2022-03-12 16:15:26 +00:00
|
|
|
|
|
|
|
// process dec
|
|
|
|
|
|
|
|
Using package types in an application is recommended to potentially work with
|
|
|
|
different protocol versions with which these types are compatible.
|
|
|
|
*/
|
|
|
|
package accounting
|