go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/server/quota/quotapb/account.proto (about) 1 // Copyright 2022 The LUCI Authors. All rights reserved. 2 // Use of this source code is governed under the Apache License, Version 2.0 3 // that can be found in the LICENSE file. 4 5 syntax = "proto3"; 6 7 import "google/protobuf/timestamp.proto"; 8 import "validate/validate.proto"; 9 10 import "go.chromium.org/luci/server/quota/quotapb/ids.proto"; 11 import "go.chromium.org/luci/server/quota/quotapb/policy.proto"; 12 13 option go_package = "go.chromium.org/luci/server/quota/quotapb"; 14 15 package go.chromium.org.luci.server.quota.quotapb; 16 17 // An Account represents the current state of a single account. 18 // 19 // Note that a given user will have an account for each resource type in each 20 // domain (realm, namespace) that they interact with. Each account tracks 21 // exactly one balance. 22 message Account { 23 // The current numeric amount balance. 24 // 25 // NOTE: The odd-looking limits are because the current implementation uses 26 // Lua5.1 (embedded in Redis) for quota accounting, which stores numbers as 27 // doubles (making the maximum safe integer range only 53 bits). It would be 28 // possible to address this limit with some work. If you have a need of an 29 // account balance under/over these thresholds, please let us know. 30 int64 balance = 1 [(validate.rules).int64 = { 31 gte: -9007199254740991 32 lte: 9007199254740991 33 }]; 34 35 // The timestamp when the `balance` was last updated. 36 // 37 // This has microsecond accuracy (but note that refresh policies are only 38 // calculated at one-second resolution). 39 google.protobuf.Timestamp updated_ts = 2 [ 40 (validate.rules).timestamp.required = true 41 ]; 42 43 // The timestamp when this account's policy last changed. 44 // 45 // This has microsecond accuracy. 46 google.protobuf.Timestamp policy_change_ts = 3 [ 47 (validate.rules).timestamp.required = true 48 ]; 49 50 // The ref for the Policy which currently applies to this Account. 51 PolicyRef policy_ref = 4 [ 52 (validate.rules).message.required = true 53 ]; 54 55 // Snapshot of the Policy which currently applies to this Account. 56 Policy policy = 5 [ 57 (validate.rules).message.required = true 58 ]; 59 }