styx: Index | Files

package qidpool

import ""

Package qidpool manages pools of 9P Qids, 13-bit unique identifiers for files.


Package Files


type Pool Uses

type Pool struct {
    // contains filtered or unexported fields

A Pool maintains a pool of unique 13-bit identifiers for files on a 9P file server. A Pool must be created with a call to New.

func New Uses

func New() *Pool

New returns a new, empty Pool.

func (*Pool) Del Uses

func (p *Pool) Del(name string)

Del removes a Qid from a Pool. Once a Qid is removed from a pool, it will never be used again.

func (*Pool) Do Uses

func (p *Pool) Do(fn func(map[interface{}]interface{}))

Do calls fn while holding the write lock for the pool

func (*Pool) Get Uses

func (p *Pool) Get(name string) (styxproto.Qid, bool)

Get fetches the Qid currently associated with name from the pool. The Qid is only valid if the second return value is true.

func (*Pool) Put Uses

func (p *Pool) Put(name string, qtype uint8) styxproto.Qid

Put creates a new, unique Qid of the given type and adds it to the pool. The returned Qid should be considered read-only. Put will not overwrite an existing Qid; if there is already a Qid associated with name, it is returned instead.

Package qidpool imports 3 packages (graph) and is imported by 4 packages. Updated 2020-07-29. Refresh now. Tools for package owners.