Add sync interval to host sets (#1680)
This adds a parameter to host sets allowing the sync interval to be user-specified on a per-host-set basis. A value of -1 disables syncing; a value of null uses the current default.
This commit is contained in:
1 parent
dba7c6b531
commit
30e9f944a2
27 files changed
+752
-231
No files matched your search
@@ -17,9 +17,10 @@ import (
|
||||
// A HostSet is a collection of hosts from the set's catalog.
|
||||
type HostSet struct {
|
||||
*store.HostSet
|
||||
PluginId string `gorm:"-"`
|
||||
HostIds []string `gorm:"-"`
|
||||
tableName string `gorm:"-"`
|
||||
PluginId string `gorm:"-"`
|
||||
HostIds []string `gorm:"-"`
|
||||
PreferredEndpoints []string `gorm:"-"`
|
||||
tableName string `gorm:"-"`
|
||||
}
|
||||
|
||||
// NewHostSet creates a new in memory HostSet assigned to catalogId. Attributes,
|
||||
@@ -35,12 +36,13 @@ func NewHostSet(ctx context.Context, catalogId string, opt ...Option) (*HostSet,
|
||||
|
||||
set := &HostSet{
|
||||
HostSet: &store.HostSet{
|
||||
CatalogId: catalogId,
|
||||
Name: opts.withName,
|
||||
Description: opts.withDescription,
|
||||
Attributes: attrs,
|
||||
PreferredEndpoints: opts.withPreferredEndpoints,
|
||||
CatalogId: catalogId,
|
||||
Name: opts.withName,
|
||||
Description: opts.withDescription,
|
||||
SyncIntervalSeconds: opts.withSyncIntervalSeconds,
|
||||
Attributes: attrs,
|
||||
},
|
||||
PreferredEndpoints: opts.withPreferredEndpoints,
|
||||
}
|
||||
|
||||
return set, nil
|
||||
@@ -69,7 +71,8 @@ func allocHostSet() *HostSet {
|
||||
func (s *HostSet) clone() *HostSet {
|
||||
cp := proto.Clone(s.HostSet)
|
||||
hs := &HostSet{
|
||||
HostSet: cp.(*store.HostSet),
|
||||
HostSet: cp.(*store.HostSet),
|
||||
PreferredEndpoints: s.PreferredEndpoints,
|
||||
}
|
||||
if s.Attributes != nil && len(s.Attributes) == 0 && hs.Attributes == nil {
|
||||
hs.Attributes = []byte{}
|
||||
@@ -92,19 +95,20 @@ func (s *HostSet) oplog(op oplog.OpType) oplog.Metadata {
|
||||
// hostSetAgg is a view that aggregates the host set's value objects in to
|
||||
// string fields delimited with the aggregateDelimiter of "|"
|
||||
type hostSetAgg struct {
|
||||
PublicId string `gorm:"primary_key"`
|
||||
CatalogId string
|
||||
PluginId string
|
||||
Name string
|
||||
Description string
|
||||
CreateTime *timestamp.Timestamp
|
||||
UpdateTime *timestamp.Timestamp
|
||||
LastSyncTime *timestamp.Timestamp
|
||||
NeedSync bool
|
||||
Version uint32
|
||||
Attributes []byte
|
||||
PreferredEndpoints string
|
||||
HostIds string
|
||||
PublicId string `gorm:"primary_key"`
|
||||
CatalogId string
|
||||
PluginId string
|
||||
Name string
|
||||
Description string
|
||||
CreateTime *timestamp.Timestamp
|
||||
UpdateTime *timestamp.Timestamp
|
||||
LastSyncTime *timestamp.Timestamp
|
||||
NeedSync bool
|
||||
SyncIntervalSeconds int32
|
||||
Version uint32
|
||||
Attributes []byte
|
||||
PreferredEndpoints string
|
||||
HostIds string
|
||||
}
|
||||
|
||||
func (agg *hostSetAgg) toHostSet(ctx context.Context) (*HostSet, error) {
|
||||
@@ -121,6 +125,7 @@ func (agg *hostSetAgg) toHostSet(ctx context.Context) (*HostSet, error) {
|
||||
hs.UpdateTime = agg.UpdateTime
|
||||
hs.LastSyncTime = agg.LastSyncTime
|
||||
hs.NeedSync = agg.NeedSync
|
||||
hs.SyncIntervalSeconds = agg.SyncIntervalSeconds
|
||||
hs.Version = agg.Version
|
||||
hs.Attributes = agg.Attributes
|
||||
if agg.HostIds != "" {
|
||||
|
||||
@@ -150,10 +150,10 @@ func TestHostSet_Create(t *testing.T) {
|
||||
},
|
||||
want: &HostSet{
|
||||
HostSet: &store.HostSet{
|
||||
CatalogId: cat.GetPublicId(),
|
||||
PreferredEndpoints: []string{"cidr:1.2.3.4"},
|
||||
Attributes: []byte{},
|
||||
CatalogId: cat.GetPublicId(),
|
||||
Attributes: []byte{},
|
||||
},
|
||||
PreferredEndpoints: []string{"cidr:1.2.3.4"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ func (r *SetSyncJob) Run(ctx context.Context) error {
|
||||
// Fetch all sets that will reach their sync point within the syncWindow.
|
||||
// This is done to avoid constantly scheduling the set sync job when there
|
||||
// are multiple sets to sync in sequence.
|
||||
err := r.reader.SearchWhere(ctx, &setAggs, `need_sync or last_sync_time <= wt_add_seconds_to_now(?)`, []interface{}{-1 * setSyncJobRunInterval.Seconds()}, db.WithLimit(r.limit))
|
||||
err := r.reader.SearchWhere(ctx, &setAggs, setSyncJobQuery, []interface{}{-1 * setSyncJobRunInterval.Seconds()}, db.WithLimit(r.limit))
|
||||
if err != nil {
|
||||
return errors.Wrap(ctx, err, op)
|
||||
}
|
||||
@@ -152,23 +152,35 @@ func nextSync(j scheduler.Job) (time.Duration, error) {
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
for rows.Next() {
|
||||
type NextResync struct {
|
||||
SyncNow bool
|
||||
ResyncIn time.Duration
|
||||
}
|
||||
var n NextResync
|
||||
err = r.ScanRows(rows, &n)
|
||||
if err != nil {
|
||||
return 0, errors.WrapDeprecated(err, op)
|
||||
}
|
||||
if n.SyncNow || n.ResyncIn < 0 {
|
||||
// If we are past the next renewal time, return 0 to schedule immediately
|
||||
return 0, nil
|
||||
}
|
||||
return n.ResyncIn * time.Second, nil
|
||||
if !rows.Next() {
|
||||
return setSyncJobRunInterval, nil
|
||||
}
|
||||
return setSyncJobRunInterval, nil
|
||||
|
||||
type NextResync struct {
|
||||
SyncNow bool
|
||||
SyncIntervalSeconds int32
|
||||
ResyncIn time.Duration
|
||||
}
|
||||
var n NextResync
|
||||
err = r.ScanRows(rows, &n)
|
||||
if err != nil {
|
||||
return 0, errors.WrapDeprecated(err, op)
|
||||
}
|
||||
switch {
|
||||
case n.SyncNow:
|
||||
// Immediate
|
||||
return 0, nil
|
||||
case n.SyncIntervalSeconds < 0:
|
||||
// In this case automatic syncing is disabled; we still sync if SyncNow
|
||||
// but otherwise do not. We schedule the job at the default cadence but
|
||||
// it will do nothing, just calculate a next run time to ensure it
|
||||
// should stay disabled.
|
||||
return setSyncJobRunInterval, nil
|
||||
case n.ResyncIn < 0:
|
||||
// Immediate
|
||||
return 0, nil
|
||||
}
|
||||
return n.ResyncIn * time.Second, nil
|
||||
}
|
||||
|
||||
// syncSets retrieves from their plugins all the host and membership information
|
||||
@@ -226,7 +238,7 @@ func (r *SetSyncJob) syncSets(ctx context.Context, setIds []string) error {
|
||||
if !ok {
|
||||
si = &setInfo{}
|
||||
}
|
||||
si.preferredEndpoint = endpoint.WithPreferenceOrder(s.GetPreferredEndpoints())
|
||||
si.preferredEndpoint = endpoint.WithPreferenceOrder(s.PreferredEndpoints)
|
||||
si.plgSet, err = toPluginSet(ctx, s)
|
||||
if err != nil {
|
||||
return errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("converting set %q to plugin set", s.GetPublicId())))
|
||||
@@ -288,7 +300,7 @@ func (r *SetSyncJob) syncSets(ctx context.Context, setIds []string) error {
|
||||
}
|
||||
|
||||
if _, err := r.upsertHosts(ctx, ci.storeCat, catSetIds, resp.GetHosts()); err != nil {
|
||||
errors.Wrap(ctx, err, op, errors.WithMsg("upserting hosts"))
|
||||
return errors.Wrap(ctx, err, op, errors.WithMsg("upserting hosts"))
|
||||
}
|
||||
|
||||
updateSyncDataQuery := `
|
||||
|
||||
@@ -13,8 +13,8 @@ import (
|
||||
hostplg "github.com/hashicorp/boundary/internal/plugin/host"
|
||||
"github.com/hashicorp/boundary/internal/scheduler"
|
||||
plgpb "github.com/hashicorp/boundary/sdk/pbs/plugin"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
assertpkg "github.com/stretchr/testify/assert"
|
||||
requirepkg "github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestNewSetSyncJob(t *testing.T) {
|
||||
@@ -109,7 +109,7 @@ func TestNewSetSyncJob(t *testing.T) {
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
assert, require := assert.New(t), require.New(t)
|
||||
assert, require := assertpkg.New(t), requirepkg.New(t)
|
||||
|
||||
got, err := newSetSyncJob(ctx, tt.args.r, tt.args.w, tt.args.kms, tt.args.plgm, tt.options...)
|
||||
if tt.wantErr {
|
||||
@@ -130,7 +130,7 @@ func TestNewSetSyncJob(t *testing.T) {
|
||||
|
||||
func TestSetSyncJob_Run(t *testing.T) {
|
||||
t.Parallel()
|
||||
assert, require := assert.New(t), require.New(t)
|
||||
assert, require := assertpkg.New(t), requirepkg.New(t)
|
||||
ctx := context.Background()
|
||||
conn, _ := db.TestSetup(t, "postgres")
|
||||
rw := db.New(conn)
|
||||
@@ -215,6 +215,136 @@ func TestSetSyncJob_Run(t *testing.T) {
|
||||
require.NoError(rw.LookupByPublicId(ctx, hs))
|
||||
assert.Greater(hs.GetLastSyncTime().AsTime().UnixNano(), firstSyncTime.AsTime().UnixNano())
|
||||
assert.False(hs.GetNeedSync())
|
||||
|
||||
// Now, run a battery of tests with values for SyncIntervalSeconds
|
||||
type setArgs struct {
|
||||
syncIntervalSeconds int32
|
||||
lastSyncTime *timestamp.Timestamp
|
||||
needsSync bool
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
setArgs setArgs
|
||||
expectSync bool
|
||||
}{
|
||||
{
|
||||
name: "never-synced-before-needs-sync-false",
|
||||
setArgs: setArgs{
|
||||
lastSyncTime: timestamp.New(time.Unix(0, 0)),
|
||||
needsSync: false,
|
||||
},
|
||||
expectSync: true,
|
||||
},
|
||||
{
|
||||
name: "never-synced-before-needs-sync-true",
|
||||
setArgs: setArgs{
|
||||
lastSyncTime: timestamp.New(time.Unix(0, 0)),
|
||||
needsSync: true,
|
||||
},
|
||||
expectSync: true,
|
||||
},
|
||||
{
|
||||
name: "never-synced-before-sync-disabled",
|
||||
setArgs: setArgs{
|
||||
syncIntervalSeconds: -1,
|
||||
lastSyncTime: timestamp.New(time.Unix(0, 0)),
|
||||
needsSync: true,
|
||||
},
|
||||
expectSync: true,
|
||||
},
|
||||
{
|
||||
name: "synced-just-now",
|
||||
setArgs: setArgs{
|
||||
lastSyncTime: timestamp.Now(),
|
||||
needsSync: false,
|
||||
},
|
||||
expectSync: false,
|
||||
},
|
||||
{
|
||||
name: "synced-just-now-need-sync",
|
||||
setArgs: setArgs{
|
||||
lastSyncTime: timestamp.Now(),
|
||||
needsSync: true,
|
||||
},
|
||||
expectSync: true,
|
||||
},
|
||||
{
|
||||
name: "synced-just-now-need-sync-but-sync-disabled",
|
||||
setArgs: setArgs{
|
||||
syncIntervalSeconds: -1,
|
||||
lastSyncTime: timestamp.Now(),
|
||||
needsSync: true,
|
||||
},
|
||||
expectSync: true,
|
||||
},
|
||||
{
|
||||
name: "synced-30-seconds-ago-default-time",
|
||||
setArgs: setArgs{
|
||||
lastSyncTime: timestamp.New(time.Now().Add(-60 * time.Second)),
|
||||
needsSync: false,
|
||||
},
|
||||
expectSync: false,
|
||||
},
|
||||
{
|
||||
name: "synced-30-seconds-ago-custom-time",
|
||||
setArgs: setArgs{
|
||||
syncIntervalSeconds: 5,
|
||||
lastSyncTime: timestamp.New(time.Now().Add(-60 * time.Second)),
|
||||
needsSync: false,
|
||||
},
|
||||
expectSync: true,
|
||||
},
|
||||
{
|
||||
name: "synced-30-seconds-ago-custom-larger-time",
|
||||
setArgs: setArgs{
|
||||
syncIntervalSeconds: 90,
|
||||
lastSyncTime: timestamp.New(time.Now().Add(-60 * time.Second)),
|
||||
needsSync: false,
|
||||
},
|
||||
expectSync: false,
|
||||
},
|
||||
{
|
||||
name: "synced-30-seconds-ago-custom-larger-time-need-sync",
|
||||
setArgs: setArgs{
|
||||
syncIntervalSeconds: 60,
|
||||
lastSyncTime: timestamp.New(time.Now().Add(-60 * time.Second)),
|
||||
needsSync: true,
|
||||
},
|
||||
expectSync: true,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
assert, require := assertpkg.New(t), requirepkg.New(t)
|
||||
|
||||
// Update set
|
||||
hs.LastSyncTime = tt.setArgs.lastSyncTime
|
||||
hs.NeedSync = tt.setArgs.needsSync
|
||||
hs.SyncIntervalSeconds = tt.setArgs.syncIntervalSeconds
|
||||
fieldMaskPaths := []string{"LastSyncTime", "NeedSync"}
|
||||
var setToNullPaths []string
|
||||
if hs.SyncIntervalSeconds == 0 {
|
||||
setToNullPaths = []string{"SyncIntervalSeconds"}
|
||||
} else {
|
||||
fieldMaskPaths = append(fieldMaskPaths, "SyncIntervalSeconds")
|
||||
}
|
||||
count, err := rw.Update(ctx, hs, fieldMaskPaths, setToNullPaths)
|
||||
require.NoError(err)
|
||||
assert.Equal(1, count)
|
||||
|
||||
// Run job
|
||||
err = r.Run(context.Background())
|
||||
require.NoError(err)
|
||||
|
||||
// Validate results
|
||||
var expNum int
|
||||
if tt.expectSync {
|
||||
expNum = 1
|
||||
}
|
||||
assert.Equal(expNum, r.numSets)
|
||||
assert.Equal(expNum, r.numProcessed)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetSyncJob_NextRunIn(t *testing.T) {
|
||||
@@ -235,8 +365,9 @@ func TestSetSyncJob_NextRunIn(t *testing.T) {
|
||||
hostSet := TestSet(t, conn, kmsCache, sched, catalog, plgm)
|
||||
|
||||
type setArgs struct {
|
||||
lastSyncTime *timestamp.Timestamp
|
||||
needsSync bool
|
||||
syncIntervalSeconds int32
|
||||
lastSyncTime *timestamp.Timestamp
|
||||
needsSync bool
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -252,6 +383,15 @@ func TestSetSyncJob_NextRunIn(t *testing.T) {
|
||||
},
|
||||
want: 0,
|
||||
},
|
||||
{
|
||||
name: "never-synced-before-with-sync-interval",
|
||||
setArgs: setArgs{
|
||||
syncIntervalSeconds: 60,
|
||||
lastSyncTime: timestamp.New(time.Unix(0, 0)),
|
||||
needsSync: false,
|
||||
},
|
||||
want: 0,
|
||||
},
|
||||
{
|
||||
name: "synced-just-now",
|
||||
setArgs: setArgs{
|
||||
@@ -260,6 +400,15 @@ func TestSetSyncJob_NextRunIn(t *testing.T) {
|
||||
},
|
||||
want: setSyncJobRunInterval,
|
||||
},
|
||||
{
|
||||
name: "synced-just-now-with-sync-interval",
|
||||
setArgs: setArgs{
|
||||
syncIntervalSeconds: 180,
|
||||
lastSyncTime: timestamp.Now(),
|
||||
needsSync: false,
|
||||
},
|
||||
want: 3 * time.Minute,
|
||||
},
|
||||
{
|
||||
name: "synced-just-now-need-sync",
|
||||
setArgs: setArgs{
|
||||
@@ -268,24 +417,67 @@ func TestSetSyncJob_NextRunIn(t *testing.T) {
|
||||
},
|
||||
want: 0,
|
||||
},
|
||||
{
|
||||
name: "synced-just-now-need-sync-with-sync-interval",
|
||||
setArgs: setArgs{
|
||||
syncIntervalSeconds: 60,
|
||||
lastSyncTime: timestamp.Now(),
|
||||
needsSync: true,
|
||||
},
|
||||
want: 0,
|
||||
},
|
||||
{
|
||||
name: "synced-a-bit-ago",
|
||||
setArgs: setArgs{
|
||||
lastSyncTime: timestamp.New(time.Now().Add(-4 * time.Minute)),
|
||||
needsSync: false,
|
||||
},
|
||||
want: time.Until(time.Now().Add(setSyncJobRunInterval - (4 * time.Minute))),
|
||||
},
|
||||
{
|
||||
name: "synced-a-bit-ago-with-sync-interval",
|
||||
setArgs: setArgs{
|
||||
syncIntervalSeconds: 300,
|
||||
lastSyncTime: timestamp.New(time.Now().Add(-4 * time.Minute)),
|
||||
needsSync: false,
|
||||
},
|
||||
want: time.Minute,
|
||||
},
|
||||
{
|
||||
name: "automatic-sync-disabled",
|
||||
setArgs: setArgs{
|
||||
syncIntervalSeconds: -1,
|
||||
lastSyncTime: timestamp.New(time.Now().Add(-4 * time.Minute)),
|
||||
needsSync: false,
|
||||
},
|
||||
want: setSyncJobRunInterval,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
assert, require := assert.New(t), require.New(t)
|
||||
assert, require := assertpkg.New(t), requirepkg.New(t)
|
||||
r, err := newSetSyncJob(ctx, rw, rw, kmsCache, plgm)
|
||||
assert.NoError(err)
|
||||
require.NotNil(r)
|
||||
|
||||
hostSet.NeedSync = tt.setArgs.needsSync
|
||||
hostSet.LastSyncTime = tt.setArgs.lastSyncTime
|
||||
_, err = rw.Update(ctx, hostSet, []string{"LastSyncTime", "NeedSync"}, nil)
|
||||
hostSet.SyncIntervalSeconds = tt.setArgs.syncIntervalSeconds
|
||||
fieldMaskPaths := []string{"LastSyncTime", "NeedSync"}
|
||||
var setToNullPaths []string
|
||||
if hostSet.SyncIntervalSeconds == 0 {
|
||||
setToNullPaths = []string{"SyncIntervalSeconds"}
|
||||
} else {
|
||||
fieldMaskPaths = append(fieldMaskPaths, "SyncIntervalSeconds")
|
||||
}
|
||||
_, err = rw.Update(ctx, hostSet, fieldMaskPaths, setToNullPaths)
|
||||
require.NoError(err)
|
||||
|
||||
got, err := r.NextRunIn()
|
||||
require.NoError(err)
|
||||
// Round to time.Minute to account for lost time between updating set and determining next run
|
||||
assert.Equal(tt.want.Round(time.Minute), got.Round(time.Minute))
|
||||
// Round to five seconds to account for lost time between updating set and determining next run
|
||||
assert.Equal(tt.want.Round(5*time.Second), got.Round(5*time.Second))
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -16,17 +16,18 @@ type Option func(*options)
|
||||
|
||||
// options = how options are represented
|
||||
type options struct {
|
||||
withPublicId string
|
||||
withPluginId string
|
||||
withName string
|
||||
withDescription string
|
||||
withAttributes *structpb.Struct
|
||||
withSecrets *structpb.Struct
|
||||
withPreferredEndpoints []string
|
||||
withIpAddresses []string
|
||||
withDnsNames []string
|
||||
withLimit int
|
||||
withSetIds []string
|
||||
withPublicId string
|
||||
withPluginId string
|
||||
withName string
|
||||
withDescription string
|
||||
withAttributes *structpb.Struct
|
||||
withSecrets *structpb.Struct
|
||||
withPreferredEndpoints []string
|
||||
withSyncIntervalSeconds int32
|
||||
withIpAddresses []string
|
||||
withDnsNames []string
|
||||
withLimit int
|
||||
withSetIds []string
|
||||
}
|
||||
|
||||
func getDefaultOptions() options {
|
||||
@@ -84,6 +85,13 @@ func WithPreferredEndpoints(with []string) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// WithSyncIntervalSeconds provides an optional sync interval, in seconds
|
||||
func WithSyncIntervalSeconds(with int32) Option {
|
||||
return func(o *options) {
|
||||
o.withSyncIntervalSeconds = with
|
||||
}
|
||||
}
|
||||
|
||||
// withIpAddresses provides an optional list of ip addresses.
|
||||
func withIpAddresses(with []string) Option {
|
||||
return func(o *options) {
|
||||
|
||||
@@ -20,6 +20,12 @@ func Test_GetOpts(t *testing.T) {
|
||||
testOpts.withName = "test"
|
||||
assert.Equal(t, opts, testOpts)
|
||||
})
|
||||
t.Run("WithSyncIntervalSeconds", func(t *testing.T) {
|
||||
opts := getOpts(WithSyncIntervalSeconds(5))
|
||||
testOpts := getDefaultOptions()
|
||||
testOpts.withSyncIntervalSeconds = 5
|
||||
assert.Equal(t, opts, testOpts)
|
||||
})
|
||||
t.Run("WithPluginId", func(t *testing.T) {
|
||||
opts := getOpts(withPluginId("test"))
|
||||
testOpts := getDefaultOptions()
|
||||
|
||||
@@ -19,10 +19,28 @@ delete from host_plugin_catalog_secret
|
||||
|
||||
setSyncNextRunInQuery = `
|
||||
select
|
||||
need_sync as sync_now,
|
||||
extract(epoch from (least(now(), last_sync_time) + ?) - now())::int as resync_in
|
||||
need_sync as sync_now,
|
||||
sync_interval_seconds,
|
||||
case
|
||||
when sync_interval_seconds is null
|
||||
then
|
||||
extract(epoch from (least(now(), last_sync_time) + ?) - now())::int
|
||||
when sync_interval_seconds > 0
|
||||
then
|
||||
extract(epoch from (least(now(), last_sync_time)) - now())::int + sync_interval_seconds
|
||||
else
|
||||
0
|
||||
end resync_in
|
||||
from host_plugin_set
|
||||
order by need_sync desc, last_sync_time desc
|
||||
limit 1;
|
||||
`
|
||||
|
||||
setSyncJobQuery = `
|
||||
need_sync
|
||||
or
|
||||
sync_interval_seconds is null and last_sync_time <= wt_add_seconds_to_now(?)
|
||||
or
|
||||
sync_interval_seconds > 0 and wt_add_seconds(sync_interval_seconds, last_sync_time) <= current_timestamp
|
||||
`
|
||||
)
|
||||
@@ -49,6 +49,9 @@ func (r *Repository) CreateSet(ctx context.Context, scopeId string, s *HostSet,
|
||||
if scopeId == "" {
|
||||
return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "no scope id")
|
||||
}
|
||||
if s.SyncIntervalSeconds < -1 {
|
||||
return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "invalid sync interval")
|
||||
}
|
||||
if s.Attributes == nil {
|
||||
return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "nil attributes")
|
||||
}
|
||||
@@ -779,7 +782,7 @@ func (r *Repository) Endpoints(ctx context.Context, setIds []string) ([]*host.En
|
||||
h := ha.toHost()
|
||||
for _, sId := range hostIdToSetIds[h.GetPublicId()] {
|
||||
s := setIdToSet[sId]
|
||||
pref, err := endpoint.NewPreferencer(ctx, endpoint.WithPreferenceOrder(s.GetPreferredEndpoints()))
|
||||
pref, err := endpoint.NewPreferencer(ctx, endpoint.WithPreferenceOrder(s.PreferredEndpoints))
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("getting preferencer for set %q", sId)))
|
||||
}
|
||||
|
||||
@@ -46,12 +46,12 @@ func TestRepository_CreateSet(t *testing.T) {
|
||||
attrs := []byte{}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
in *HostSet
|
||||
opts []Option
|
||||
want *HostSet
|
||||
name string
|
||||
in *HostSet
|
||||
opts []Option
|
||||
want *HostSet
|
||||
wantPluginCalled bool
|
||||
wantIsErr errors.Code
|
||||
wantIsErr errors.Code
|
||||
}{
|
||||
{
|
||||
name: "nil-HostSet",
|
||||
@@ -91,6 +91,17 @@ func TestRepository_CreateSet(t *testing.T) {
|
||||
},
|
||||
wantIsErr: errors.InvalidParameter,
|
||||
},
|
||||
{
|
||||
name: "invalid-sync-interval-too-negative",
|
||||
in: &HostSet{
|
||||
HostSet: &store.HostSet{
|
||||
CatalogId: catalog.PublicId,
|
||||
SyncIntervalSeconds: -99,
|
||||
Attributes: attrs,
|
||||
},
|
||||
},
|
||||
wantIsErr: errors.InvalidParameter,
|
||||
},
|
||||
{
|
||||
name: "valid-no-options",
|
||||
in: &HostSet{
|
||||
@@ -111,17 +122,17 @@ func TestRepository_CreateSet(t *testing.T) {
|
||||
name: "valid-preferred-endpoints",
|
||||
in: &HostSet{
|
||||
HostSet: &store.HostSet{
|
||||
CatalogId: catalog.PublicId,
|
||||
Attributes: attrs,
|
||||
PreferredEndpoints: []string{"cidr:1.2.3.4/32", "dns:a.b.c"},
|
||||
CatalogId: catalog.PublicId,
|
||||
Attributes: attrs,
|
||||
},
|
||||
PreferredEndpoints: []string{"cidr:1.2.3.4/32", "dns:a.b.c"},
|
||||
},
|
||||
want: &HostSet{
|
||||
HostSet: &store.HostSet{
|
||||
CatalogId: catalog.PublicId,
|
||||
Attributes: attrs,
|
||||
PreferredEndpoints: []string{"cidr:1.2.3.4/32", "dns:a.b.c"},
|
||||
CatalogId: catalog.PublicId,
|
||||
Attributes: attrs,
|
||||
},
|
||||
PreferredEndpoints: []string{"cidr:1.2.3.4/32", "dns:a.b.c"},
|
||||
},
|
||||
wantPluginCalled: true,
|
||||
},
|
||||
@@ -143,6 +154,42 @@ func TestRepository_CreateSet(t *testing.T) {
|
||||
},
|
||||
wantPluginCalled: true,
|
||||
},
|
||||
{
|
||||
name: "valid-sync-interval-disabled",
|
||||
in: &HostSet{
|
||||
HostSet: &store.HostSet{
|
||||
CatalogId: catalog.PublicId,
|
||||
SyncIntervalSeconds: -1,
|
||||
Attributes: attrs,
|
||||
},
|
||||
},
|
||||
want: &HostSet{
|
||||
HostSet: &store.HostSet{
|
||||
CatalogId: catalog.PublicId,
|
||||
SyncIntervalSeconds: -1,
|
||||
Attributes: attrs,
|
||||
},
|
||||
},
|
||||
wantPluginCalled: true,
|
||||
},
|
||||
{
|
||||
name: "valid-sync-interval-positive",
|
||||
in: &HostSet{
|
||||
HostSet: &store.HostSet{
|
||||
CatalogId: catalog.PublicId,
|
||||
SyncIntervalSeconds: 60,
|
||||
Attributes: attrs,
|
||||
},
|
||||
},
|
||||
want: &HostSet{
|
||||
HostSet: &store.HostSet{
|
||||
CatalogId: catalog.PublicId,
|
||||
SyncIntervalSeconds: 60,
|
||||
Attributes: attrs,
|
||||
},
|
||||
},
|
||||
wantPluginCalled: true,
|
||||
},
|
||||
{
|
||||
name: "valid-unimplemented-plugin",
|
||||
in: &HostSet{
|
||||
@@ -187,7 +234,7 @@ func TestRepository_CreateSet(t *testing.T) {
|
||||
Description: ("test-description-repo"),
|
||||
Attributes: func() []byte {
|
||||
st, err := structpb.NewStruct(map[string]interface{}{
|
||||
"k1": "foo",
|
||||
"k1": "foo",
|
||||
"removed": nil,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
@@ -1129,7 +1176,7 @@ func TestRepository_LookupSet(t *testing.T) {
|
||||
return &plgpb.ListHostsResponse{}, nil
|
||||
},
|
||||
}),
|
||||
})
|
||||
}, WithSyncIntervalSeconds(5))
|
||||
hostSetId, err := newHostSetId(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1192,9 +1239,9 @@ func TestRepository_Endpoints(t *testing.T) {
|
||||
}
|
||||
|
||||
catalog := TestCatalog(t, conn, prj.PublicId, plg.GetPublicId())
|
||||
hostSet10 := TestSet(t, conn, kms, sched, catalog, plgm, WithPreferredEndpoints([]string{"cidr:10.0.0.1/24"}))
|
||||
hostSet192 := TestSet(t, conn, kms, sched, catalog, plgm, WithPreferredEndpoints([]string{"cidr:192.168.0.1/24"}))
|
||||
hostSet100 := TestSet(t, conn, kms, sched, catalog, plgm, WithPreferredEndpoints([]string{"cidr:100.100.100.100/24"}))
|
||||
hostSet10 := TestSet(t, conn, kms, sched, catalog, plgm, WithName("hostSet10"), WithPreferredEndpoints([]string{"cidr:10.0.0.1/24"}))
|
||||
hostSet192 := TestSet(t, conn, kms, sched, catalog, plgm, WithName("hostSet192"), WithPreferredEndpoints([]string{"cidr:192.168.0.1/24"}))
|
||||
hostSet100 := TestSet(t, conn, kms, sched, catalog, plgm, WithName("hostSet100"), WithPreferredEndpoints([]string{"cidr:100.100.100.100/24"}))
|
||||
hostlessSet := TestSet(t, conn, kms, sched, hostlessCatalog, plgm)
|
||||
|
||||
h1 := TestHost(t, conn, catalog.GetPublicId(), "test", withIpAddresses([]string{"10.0.0.5", "192.168.0.5"}))
|
||||
|
||||
@@ -195,6 +195,9 @@ type HostSet struct {
|
||||
// preferred_endpoints stores string preference values
|
||||
// @inject_tag: `gorm:"-"`
|
||||
PreferredEndpoints []string `protobuf:"bytes,11,rep,name=preferred_endpoints,json=preferredEndpoints,proto3" json:"preferred_endpoints,omitempty" gorm:"-"`
|
||||
// Sync interval is a value representing a duration in seconds
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
SyncIntervalSeconds int32 `protobuf:"varint,12,opt,name=sync_interval_seconds,json=syncIntervalSeconds,proto3" json:"sync_interval_seconds,omitempty" gorm:"default:null"`
|
||||
}
|
||||
|
||||
func (x *HostSet) Reset() {
|
||||
@@ -306,6 +309,13 @@ func (x *HostSet) GetPreferredEndpoints() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *HostSet) GetSyncIntervalSeconds() int32 {
|
||||
if x != nil {
|
||||
return x.SyncIntervalSeconds
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type HostCatalogSecret struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -659,7 +669,7 @@ var file_controller_storage_host_plugin_store_v1_host_proto_rawDesc = []byte{
|
||||
0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d,
|
||||
0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x74, 0x74,
|
||||
0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x61,
|
||||
0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x22, 0xa1, 0x04, 0x0a, 0x07, 0x48, 0x6f,
|
||||
0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x22, 0x87, 0x05, 0x0a, 0x07, 0x48, 0x6f,
|
||||
0x73, 0x74, 0x53, 0x65, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f,
|
||||
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63,
|
||||
0x49, 0x64, 0x12, 0x4b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d,
|
||||
@@ -693,61 +703,67 @@ var file_controller_storage_host_plugin_store_v1_host_proto_rawDesc = []byte{
|
||||
0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x2f, 0x0a, 0x13,
|
||||
0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x64, 0x5f, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69,
|
||||
0x6e, 0x74, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x70, 0x72, 0x65, 0x66, 0x65,
|
||||
0x72, 0x72, 0x65, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x22, 0x98, 0x02,
|
||||
0x0a, 0x11, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x53, 0x65, 0x63,
|
||||
0x72, 0x65, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69,
|
||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67,
|
||||
0x49, 0x64, 0x12, 0x4b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f,
|
||||
0x72, 0x72, 0x65, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x64, 0x0a,
|
||||
0x15, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x5f, 0x73,
|
||||
0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x42, 0x30, 0xc2, 0xdd,
|
||||
0x29, 0x2c, 0x0a, 0x13, 0x53, 0x79, 0x6e, 0x63, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c,
|
||||
0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x15, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x69, 0x6e,
|
||||
0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x52, 0x13,
|
||||
0x73, 0x79, 0x6e, 0x63, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x53, 0x65, 0x63, 0x6f,
|
||||
0x6e, 0x64, 0x73, 0x22, 0x98, 0x02, 0x0a, 0x11, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61,
|
||||
0x6c, 0x6f, 0x67, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x61, 0x74,
|
||||
0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63,
|
||||
0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x49, 0x64, 0x12, 0x4b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61,
|
||||
0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e,
|
||||
0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61,
|
||||
0x67, 0x65, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74,
|
||||
0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x4b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f,
|
||||
0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e,
|
||||
0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e,
|
||||
0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x69, 0x6d,
|
||||
0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69,
|
||||
0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01,
|
||||
0x28, 0x0c, 0x52, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x74,
|
||||
0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63,
|
||||
0x74, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69,
|
||||
0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x22, 0x8d,
|
||||
0x03, 0x0a, 0x04, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69,
|
||||
0x63, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x75, 0x62, 0x6c,
|
||||
0x69, 0x63, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,
|
||||
0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x72,
|
||||
0x6e, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x4b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f,
|
||||
0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e,
|
||||
0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e,
|
||||
0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x69, 0x6d,
|
||||
0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69,
|
||||
0x6d, 0x65, 0x12, 0x4b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f,
|
||||
0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74,
|
||||
0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12,
|
||||
0x4b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65,
|
||||
0x72, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74,
|
||||
0x61, 0x6d, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
|
||||
0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06,
|
||||
0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x65,
|
||||
0x63, 0x72, 0x65, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65,
|
||||
0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63, 0x74, 0x53, 0x65, 0x63, 0x72, 0x65,
|
||||
0x74, 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x22, 0x8d, 0x03, 0x0a, 0x04, 0x48, 0x6f, 0x73,
|
||||
0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x49, 0x64, 0x12, 0x1f,
|
||||
0x0a, 0x0b, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x49, 0x64, 0x12,
|
||||
0x4b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65,
|
||||
0x72, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74,
|
||||
0x61, 0x6d, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
|
||||
0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x4b, 0x0a, 0x0b,
|
||||
0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73,
|
||||
0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
|
||||
0x2e, 0x76, 0x31, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x75,
|
||||
0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
|
||||
0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a,
|
||||
0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12,
|
||||
0x1d, 0x0a, 0x0a, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x07, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x49, 0x64, 0x12, 0x18,
|
||||
0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d, 0x52,
|
||||
0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x70, 0x5f, 0x61,
|
||||
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b,
|
||||
0x69, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x64,
|
||||
0x6e, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08,
|
||||
0x64, 0x6e, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0x5e, 0x0a, 0x0d, 0x48, 0x6f, 0x73, 0x74,
|
||||
0x53, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x07, 0x68, 0x6f, 0x73,
|
||||
0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x6f, 0x73, 0x74,
|
||||
0x49, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x05, 0x73, 0x65, 0x74, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x61, 0x74,
|
||||
0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63,
|
||||
0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x49, 0x64, 0x42, 0x40, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68,
|
||||
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70,
|
||||
0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e,
|
||||
0x61, 0x6c, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x73,
|
||||
0x74, 0x6f, 0x72, 0x65, 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x33,
|
||||
0x61, 0x6d, 0x70, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12,
|
||||
0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
|
||||
0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
|
||||
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67,
|
||||
0x5f, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x61, 0x74, 0x61, 0x6c,
|
||||
0x6f, 0x67, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18,
|
||||
0x08, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21,
|
||||
0x0a, 0x0c, 0x69, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x09,
|
||||
0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x69, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65,
|
||||
0x73, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x6e, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x0a,
|
||||
0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x64, 0x6e, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0x5e,
|
||||
0x0a, 0x0d, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12,
|
||||
0x17, 0x0a, 0x07, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x06, 0x68, 0x6f, 0x73, 0x74, 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x73, 0x65, 0x74, 0x5f,
|
||||
0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x65, 0x74, 0x49, 0x64, 0x12,
|
||||
0x1d, 0x0a, 0x0a, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x49, 0x64, 0x42, 0x40,
|
||||
0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73,
|
||||
0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f,
|
||||
0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2f, 0x70, 0x6c,
|
||||
0x75, 0x67, 0x69, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x65,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
Reference in new issue
Block a user