ring: github.com/TheTannerRyan/ring Index | Files | Directories

package ring

import "github.com/TheTannerRyan/ring"

Package ring provides a high performance and thread safe bloom filter.

License

Copyright (c) 2019 Tanner Ryan. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Package Files

doc.go hash.go ring.go

type Ring Uses

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

Ring contains the information for a ring data store.

func Init Uses

func Init(elements int, falsePositive float64) (*Ring, error)

Init initializes and returns a new ring, or an error. Given a number of elements, it accurately states if data is not added. Within a falsePositive rate, it will indicate if the data has been added.

func (*Ring) Add Uses

func (r *Ring) Add(data []byte)

Add adds the data to the ring.

func (*Ring) Reset Uses

func (r *Ring) Reset()

Reset clears the ring.

func (*Ring) Test Uses

func (r *Ring) Test(data []byte) bool

Test returns a bool if the data is in the ring. True indicates that the data may be in the ring, while false indicates that the data is not in the ring.

Directories

PathSynopsis
example

Package ring imports 3 packages (graph). Updated 2019-02-19. Refresh now. Tools for package owners.