-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
tenant.go
34 lines (29 loc) · 1.31 KB
/
tenant.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2020 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
package roachpb
import "strconv"
// A TenantID is a unique ID associated with a tenant in a multi-tenant cluster.
// Each tenant is granted exclusive access to a portion of the keyspace and a
// collection of SQL tables in that keyspace which comprise a "logical" cluster.
type TenantID uint64
// SystemTenantID is the ID associated with the system's internal tenant in a
// multi-tenant cluster and the only tenant in a single-tenant cluster. The
// system tenant differs from all other tenants in three important ways:
// 1. the system tenant's keyspace is not prefixed with a tenant specifier.
// 2. the system tenant is created by default during cluster initialization.
// 2. the system tenant had the ability to create and destroy other tenants.
const SystemTenantID TenantID = 1
// String implements the fmt.Stringer interface.
func (t TenantID) String() string {
if t == SystemTenantID {
return "system"
}
return strconv.FormatUint(uint64(t), 10)
}