logquebuf

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2022 License: MIT Imports: 5 Imported by: 0

README

logbuf

LogBuffer

type LogBuffer struct {
	trie       *ctrie.Ctrie
	bufferSize int
	signals    map[string]chan struct{}
}

LogBuffer has a ctrie.Ctrie instance for topic.
And signals is a map of channel for topic.
Finally, bufferSize is a size of queue for buffer.

New

func New(bufferSize int) *LogBuffer

New constructor is a constructor of LogBuffer with given buffer size.

AddTopic

func (e *LogBuffer) AddTopic(topic string, signal chan struct{})

AddTopic add a topic to LogBuffer instance and initialize signal.

RemoveTopic

func (e *LogBuffer) RemoveTopic(topic string)

RemoveTopic remove a topic from LogBuffer instance.
DO NOT CALL THIS MENIALY.

Enqueue

func (e *LogBuffer) EnQueue(topic string, value log.Log)

Enqueue method is push value to topic queue in LogBuffer.

Dequeue

func (e *LogBuffer) DeQueue(topic string) (log.Log, error)

Dequeue method is pop value from topic queue in LogBuffer.

ctrie LICENSE

Copyright 2015 Workiva, LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package ctrie provides an implementation of the Ctrie data structure, which is a concurrent, lock-free hash trie. This data structure was originally presented in the paper Concurrent Tries with Efficient Non-Blocking Snapshots: https://axel22.github.io/resources/docs/ctries-snapshot.pdf

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogQueueBuffer

type LogQueueBuffer struct {
	// contains filtered or unexported fields
}

func New

func New(bufferSize int) *LogQueueBuffer

func (*LogQueueBuffer) AddTopic

func (e *LogQueueBuffer) AddTopic(topic string, signal chan struct{})

func (*LogQueueBuffer) DeQueue

func (e *LogQueueBuffer) DeQueue(topic string) (log.Log, error)

func (*LogQueueBuffer) EnQueue

func (e *LogQueueBuffer) EnQueue(topic string, value log.Log)

func (*LogQueueBuffer) RemoveTopic

func (e *LogQueueBuffer) RemoveTopic(topic string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL