From 45c8fbaedbc9aee43727eac21a9ad2c75b920cd6 Mon Sep 17 00:00:00 2001 From: trollyxia Date: Thu, 14 Mar 2024 13:48:13 +0000 Subject: [PATCH] Expose FamilySubset struct Change-Id: Ia07847f4c43197d8498ead0e225651fe2b4713d7 --- bigtable/admin.go | 15 ++++++++------- bigtable/integration_test.go | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/bigtable/admin.go b/bigtable/admin.go index f42a9bcf62e3..15c0036ae1cc 100644 --- a/bigtable/admin.go +++ b/bigtable/admin.go @@ -2249,7 +2249,8 @@ func (av *AuthorizedViewTypeConf) GetSubsetView() (*SubsetViewConf, error) { return av.SubsetView, nil } -type familySubset struct { +// FamilySubset represents a subset of a column family. +type FamilySubset struct { Qualifiers [][]byte QualifierPrefixes [][]byte } @@ -2257,7 +2258,7 @@ type familySubset struct { // SubsetViewConf contains configuration specific to an authorized view of subset view type. type SubsetViewConf struct { RowPrefixes [][]byte - FamilySubsets map[string]familySubset + FamilySubsets map[string]FamilySubset } // AddRowPrefix adds a new row prefix to the subset view. @@ -2265,12 +2266,12 @@ func (s *SubsetViewConf) AddRowPrefix(prefix []byte) { s.RowPrefixes = append(s.RowPrefixes, prefix) } -func (s *SubsetViewConf) getFamilySubset(familyName string) familySubset { +func (s *SubsetViewConf) getFamilySubset(familyName string) FamilySubset { if s.FamilySubsets == nil { - s.FamilySubsets = make(map[string]familySubset) + s.FamilySubsets = make(map[string]FamilySubset) } if _, ok := s.FamilySubsets[familyName]; !ok { - s.FamilySubsets[familyName] = familySubset{ + s.FamilySubsets[familyName] = FamilySubset{ Qualifiers: [][]byte{}, QualifierPrefixes: [][]byte{}, } @@ -2297,10 +2298,10 @@ func (s *SubsetViewConf) fillConf(internal *btapb.AuthorizedView_SubsetView) { s.RowPrefixes = [][]byte{} s.RowPrefixes = append(s.RowPrefixes, internal.RowPrefixes...) if s.FamilySubsets == nil { - s.FamilySubsets = make(map[string]familySubset) + s.FamilySubsets = make(map[string]FamilySubset) } for k, v := range internal.FamilySubsets { - s.FamilySubsets[k] = familySubset{ + s.FamilySubsets[k] = FamilySubset{ Qualifiers: v.Qualifiers, QualifierPrefixes: v.QualifierPrefixes, } diff --git a/bigtable/integration_test.go b/bigtable/integration_test.go index 5aae83c67ba8..6439f2e461b0 100644 --- a/bigtable/integration_test.go +++ b/bigtable/integration_test.go @@ -3660,7 +3660,7 @@ func TestIntegration_DataAuthorizedView(t *testing.T) { AuthorizedViewType: AuthorizedViewTypeSubsetView, SubsetView: &SubsetViewConf{ RowPrefixes: [][]byte{[]byte("r1")}, - FamilySubsets: map[string]familySubset{ + FamilySubsets: map[string]FamilySubset{ "fam1": { QualifierPrefixes: [][]byte{[]byte("col")}, },