update go-structr to v0.8.8 (#3199)

This commit is contained in:
kim
2024-08-14 12:08:24 +00:00
committed by GitHub
parent 9cd27b412d
commit f8d5b9f49c
11 changed files with 53 additions and 53 deletions

View File

@@ -20,17 +20,6 @@ func DefaultIgnoreErr(err error) bool {
// for initializing a struct cache.
type CacheConfig[StructType any] struct {
// Indices defines indices to create
// in the Cache for the receiving
// generic struct type parameter.
Indices []IndexConfig
// MaxSize defines the maximum number
// of items allowed in the Cache at
// one time, before old items start
// getting evicted.
MaxSize int
// IgnoreErr defines which errors to
// ignore (i.e. not cache) returned
// from load function callback calls.
@@ -48,6 +37,17 @@ type CacheConfig[StructType any] struct {
// as the values passed to Put() / Store(),
// or by the keys by calls to Invalidate().
Invalidate func(StructType)
// Indices defines indices to create
// in the Cache for the receiving
// generic struct type parameter.
Indices []IndexConfig
// MaxSize defines the maximum number
// of items allowed in the Cache at
// one time, before old items start
// getting evicted.
MaxSize int
}
// Cache provides a structure cache with automated
@@ -56,24 +56,24 @@ type CacheConfig[StructType any] struct {
// of negative results (errors!) returned by LoadOne().
type Cache[StructType any] struct {
// indices used in storing passed struct
// types by user defined sets of fields.
indices []Index
// hook functions.
ignore func(error) bool
copy func(StructType) StructType
invalid func(StructType)
// keeps track of all indexed items,
// in order of last recently used (LRU).
lru list
// indices used in storing passed struct
// types by user defined sets of fields.
indices []Index
// max cache size, imposes size
// limit on the lruList in order
// to evict old entries.
maxSize int
// hook functions.
ignore func(error) bool
copy func(StructType) StructType
invalid func(StructType)
// protective mutex, guards:
// - Cache{}.lruList
// - Index{}.data

View File

@@ -349,15 +349,15 @@ type index_entry struct {
// elem.data is ptr to index_entry.
elem list_elem
// raw cache key
// for this entry.
key string
// index this is stored in.
index *Index
// underlying indexed item.
item *indexed_item
// raw cache key
// for this entry.
key string
}
var index_entry_pool sync.Pool

View File

@@ -10,12 +10,12 @@ type indexed_item struct {
// is stored in a main list.
elem list_elem
// cached data with type.
data interface{}
// indexed stores the indices
// this item is stored under.
indexed []*index_entry
// cached data with type.
data interface{}
}
var indexed_item_pool sync.Pool

View File

@@ -10,8 +10,8 @@ import (
// lookup (potentially) stored
// entries in an Index.
type Key struct {
raw []any
key string
raw []any
}
// Key returns the underlying cache key string.

View File

@@ -10,15 +10,15 @@ import (
// for initializing a struct queue.
type QueueConfig[StructType any] struct {
// Indices defines indices to create
// in the Queue for the receiving
// generic struct parameter type.
Indices []IndexConfig
// Pop is called when queue values
// are popped, during calls to any
// of the Pop___() series of fns.
Pop func(StructType)
// Indices defines indices to create
// in the Queue for the receiving
// generic struct parameter type.
Indices []IndexConfig
}
// Queue provides a structure model queue with
@@ -26,17 +26,17 @@ type QueueConfig[StructType any] struct {
// defined lookups of field combinations.
type Queue[StructType any] struct {
// indices used in storing passed struct
// types by user defined sets of fields.
indices []Index
// hook functions.
copy func(StructType) StructType
pop func(StructType)
// main underlying
// struct item queue.
queue list
// hook functions.
copy func(StructType) StructType
pop func(StructType)
// indices used in storing passed struct
// types by user defined sets of fields.
indices []Index
// protective mutex, guards:
// - Queue{}.queue

View File

@@ -6,8 +6,8 @@ import (
// QueueCtx is a context-aware form of Queue{}.
type QueueCtx[StructType any] struct {
Queue[StructType]
ch chan struct{}
Queue[StructType]
}
// PopFront pops the current value at front of the queue, else blocking on ctx.

View File

@@ -16,10 +16,6 @@ import (
type struct_field struct {
rtype reflect.Type
// offsets defines whereabouts in
// memory this field is located.
offsets []next_offset
// struct field type mangling
// (i.e. fast serializing) fn.
mangle mangler.Mangler
@@ -33,6 +29,10 @@ type struct_field struct {
// if set this indicates zero
// values of field not allowed
zerostr string
// offsets defines whereabouts in
// memory this field is located.
offsets []next_offset
}
// next_offset defines a next offset location