Skip to content

ipfs/go-dsqueue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-dsqueue

Build Status GoDoc

Buffered FIFO interface to the datastore

The dsqueue package provides a buffered FIFO queue backed by a Batching Datastore. Queued items are persisted in the datastore when the input buffer is full, after some amount of idle time, and when the queue is shuddown.

Documentation

https://pkg.go.dev/github.com/ipfs/go-dsqueue

Example

ds = getBatchingDatastore() 
dsq := dsqueue.New(ds, "ExampleQueue")
defer dsq.Close()

c, err := cid.Decode("QmPNHBy5h7f19yJDt7ip9TvmMRbqmYsa6aetkrsc1ghjLB")
if err != nil {
    panic(err)
}

dsq.Put(c.Bytes())

out := <-dsq.Out()
c2, err := cid.Parse(out)
if err != nil {
    panic(err)
}

if c2 != c {
    fmt.Fprintln(os.Stderr, "cids are not quual")
}

Lead Maintainer

@gammazero

Contributing

Contributions are welcome! This repository is part of the IPFS project and therefore governed by our contributing guidelines.

License

SPDX-License-Identifier: Apache-2.0 OR MIT

About

Buffered FIFO interface to datastore

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages