Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for NewBatch (0.2 sec)

  1. internal/store/batch.go

    func (b *Batch[K, T]) IsFull() bool {
    	b.Lock()
    	defer b.Unlock()
    
    	return b.isFull()
    }
    
    func (b *Batch[K, T]) isFull() bool {
    	return len(b.items) >= int(b.limit)
    }
    
    // NewBatch creates a new batch
    func NewBatch[K key, T any](limit uint32) *Batch[K, T] {
    	return &Batch[K, T]{
    		keys:  make([]K, 0, limit),
    		items: make(map[K]T, limit),
    		limit: limit,
    	}
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Sat Oct 07 15:07:38 GMT 2023
    - 2.5K bytes
    - Viewed (0)
  2. internal/store/batch_test.go

    // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    package store
    
    import (
    	"errors"
    	"sync"
    	"testing"
    )
    
    func TestBatch(t *testing.T) {
    	var limit uint32 = 100
    	batch := NewBatch[int, int](limit)
    	for i := 0; i < int(limit); i++ {
    		if err := batch.Add(i, i); err != nil {
    			t.Fatalf("failed to add %v; %v", i, err)
    		}
    		if _, ok := batch.GetByKey(i); !ok {
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Sat Oct 07 15:07:38 GMT 2023
    - 3.8K bytes
    - Viewed (0)
  3. internal/event/target/kafka.go

    		args:       args,
    		store:      queueStore,
    		loggerOnce: loggerOnce,
    		quitCh:     make(chan struct{}),
    	}
    
    	if target.store != nil {
    		if args.BatchSize > 1 {
    			target.batch = store.NewBatch[string, *sarama.ProducerMessage](args.BatchSize)
    		}
    		store.StreamItems(target.store, target, target.quitCh, target.loggerOnce)
    	}
    
    	return target, nil
    }
    
    func isKafkaConnErr(err error) bool {
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Tue Feb 20 08:16:35 GMT 2024
    - 13K bytes
    - Viewed (0)
  4. CHANGELOG/CHANGELOG-1.16.md

    - Fixes a bug that when there is a "connection refused" error, the reflector's ListAndWatch func will return directly but what expected is that sleep 1 second and rewatch since the specified resourceVersion.
      ([#81634](https://github.com/kubernetes/kubernetes/pull/81634), [@likakuli](https://github.com/likakuli))
    Plain Text
    - Registered: Fri Apr 26 09:05:10 GMT 2024
    - Last Modified: Thu Feb 11 10:00:57 GMT 2021
    - 345.2K bytes
    - Viewed (0)
Back to top