blob: 03e37234bb97e6bdd549648b1c9f5a4dc6f2eae7 [file] [log] [blame]
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This file was auto-generated by the vanadium vdl tool.
// Package: server
package server
import (
"v.io/v23/security/access"
"v.io/v23/services/groups"
"v.io/v23/vdl"
)
var _ = __VDLInit() // Must be first; see __VDLInit comments for details.
//////////////////////////////////////////////////
// Type definitions
// groupData represents the persistent state of a group. (The group name is
// persisted as the store entry key.)
type groupData struct {
Perms access.Permissions
Entries map[groups.BlessingPatternChunk]struct{}
}
func (groupData) __VDLReflect(struct {
Name string `vdl:"v.io/x/ref/services/groups/internal/server.groupData"`
}) {
}
func (x groupData) VDLIsZero() bool {
if len(x.Perms) != 0 {
return false
}
if len(x.Entries) != 0 {
return false
}
return true
}
func (x groupData) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(__VDLType_struct_1); err != nil {
return err
}
if len(x.Perms) != 0 {
if err := enc.NextField(0); err != nil {
return err
}
if err := x.Perms.VDLWrite(enc); err != nil {
return err
}
}
if len(x.Entries) != 0 {
if err := enc.NextField(1); err != nil {
return err
}
if err := __VDLWriteAnon_set_1(enc, x.Entries); err != nil {
return err
}
}
if err := enc.NextField(-1); err != nil {
return err
}
return enc.FinishValue()
}
func __VDLWriteAnon_set_1(enc vdl.Encoder, x map[groups.BlessingPatternChunk]struct{}) error {
if err := enc.StartValue(__VDLType_set_3); err != nil {
return err
}
if err := enc.SetLenHint(len(x)); err != nil {
return err
}
for key := range x {
if err := enc.NextEntryValueString(__VDLType_string_4, string(key)); err != nil {
return err
}
}
if err := enc.NextEntry(true); err != nil {
return err
}
return enc.FinishValue()
}
func (x *groupData) VDLRead(dec vdl.Decoder) error {
*x = groupData{}
if err := dec.StartValue(__VDLType_struct_1); err != nil {
return err
}
decType := dec.Type()
for {
index, err := dec.NextField()
switch {
case err != nil:
return err
case index == -1:
return dec.FinishValue()
}
if decType != __VDLType_struct_1 {
index = __VDLType_struct_1.FieldIndexByName(decType.Field(index).Name)
if index == -1 {
if err := dec.SkipValue(); err != nil {
return err
}
continue
}
}
switch index {
case 0:
if err := x.Perms.VDLRead(dec); err != nil {
return err
}
case 1:
if err := __VDLReadAnon_set_1(dec, &x.Entries); err != nil {
return err
}
}
}
}
func __VDLReadAnon_set_1(dec vdl.Decoder, x *map[groups.BlessingPatternChunk]struct{}) error {
if err := dec.StartValue(__VDLType_set_3); err != nil {
return err
}
var tmpMap map[groups.BlessingPatternChunk]struct{}
if len := dec.LenHint(); len > 0 {
tmpMap = make(map[groups.BlessingPatternChunk]struct{}, len)
}
for {
switch done, key, err := dec.NextEntryValueString(); {
case err != nil:
return err
case done:
*x = tmpMap
return dec.FinishValue()
default:
if tmpMap == nil {
tmpMap = make(map[groups.BlessingPatternChunk]struct{})
}
tmpMap[groups.BlessingPatternChunk(key)] = struct{}{}
}
}
}
// Hold type definitions in package-level variables, for better performance.
var (
__VDLType_struct_1 *vdl.Type
__VDLType_map_2 *vdl.Type
__VDLType_set_3 *vdl.Type
__VDLType_string_4 *vdl.Type
)
var __VDLInitCalled bool
// __VDLInit performs vdl initialization. It is safe to call multiple times.
// If you have an init ordering issue, just insert the following line verbatim
// into your source files in this package, right after the "package foo" clause:
//
// var _ = __VDLInit()
//
// The purpose of this function is to ensure that vdl initialization occurs in
// the right order, and very early in the init sequence. In particular, vdl
// registration and package variable initialization needs to occur before
// functions like vdl.TypeOf will work properly.
//
// This function returns a dummy value, so that it can be used to initialize the
// first var in the file, to take advantage of Go's defined init order.
func __VDLInit() struct{} {
if __VDLInitCalled {
return struct{}{}
}
__VDLInitCalled = true
// Register types.
vdl.Register((*groupData)(nil))
// Initialize type definitions.
__VDLType_struct_1 = vdl.TypeOf((*groupData)(nil)).Elem()
__VDLType_map_2 = vdl.TypeOf((*access.Permissions)(nil))
__VDLType_set_3 = vdl.TypeOf((*map[groups.BlessingPatternChunk]struct{})(nil))
__VDLType_string_4 = vdl.TypeOf((*groups.BlessingPatternChunk)(nil))
return struct{}{}
}