Documentation ¶
Overview ¶
Package list_head ... like a kernel's LIST_HEAD list_head is used by loncha/gen/containers_list
Package loncha/list_head is like a kernel's LIST_HEAD list_head is used by loncha/gen/containers_list
Package loncha/list_head is like a kernel's LIST_HEAD list_head is used by loncha/gen/containers_list
Index ¶
- Constants
- Variables
- func AddRecoverState(name string)
- func Cas(target **ListHead, old, new *ListHead) bool
- func ContainOf(head, elm *ListHead) bool
- func ElementIsContainOf(hList, l List) bool
- func ElementOf(l List, head *ListHead) unsafe.Pointer
- func Error(oe error, opts ...OptNewError) error
- func GetConcurrentMode() bool
- func InitAfterSafety(retry int) func(*ListHead) error
- func MarkListHead(target **ListHead, old *ListHead) bool
- func Retry(cnt int, fn func(retry int) (done bool, err error)) error
- func StoreListHead(dst **ListHead, src *ListHead)
- type BoolAndError
- type Cursor
- type List
- type ListHead
- func (head *ListHead) ActiveList() *ListHead
- func (head *ListHead) Add(new *ListHead) *ListHead
- func (head *ListHead) AddElement(nList List) *ListHead
- func (head *ListHead) Append(new *ListHead) (*ListHead, error)
- func (head *ListHead) AppendWithRecover(new *ListHead) (nHead *ListHead, err error)
- func (head *ListHead) AvoidNotAppend(err error) *ListHead
- func (l *ListHead) Back() (head *ListHead)
- func (l *ListHead) Cursor() Cursor
- func (l *ListHead) Delete() (result *ListHead)
- func (head *ListHead) DeleteElementWithCas(pList List) (err error)
- func (head *ListHead) DeleteWithCas(prev *ListHead) (err error)
- func (head *ListHead) DirectNext() *ListHead
- func (head *ListHead) DumpAll() string
- func (head *ListHead) DumpAllWithMark() string
- func (l *ListHead) Each(fn func(e *ListHead))
- func (l *ListHead) Empty() bool
- func (l *ListHead) Front() (head *ListHead)
- func (head *ListHead) Init()
- func (head *ListHead) InitAsEmpty()
- func (l *ListHead) InsertAfter(vl List) *ListHead
- func (head *ListHead) InsertBefore(new *ListHead) (*ListHead, error)
- func (l *ListHead) IsFirst() bool
- func (l *ListHead) IsFirstMarked() bool
- func (l *ListHead) IsLast() bool
- func (head *ListHead) IsMarked() bool
- func (head *ListHead) IsPurged() bool
- func (head *ListHead) IsSafety() (bool, error)
- func (head *ListHead) IsSingle() bool
- func (head *ListHead) Join(new *ListHead)
- func (l *ListHead) Len() (cnt int)
- func (l *ListHead) MarkForDelete() (err error)
- func (l *ListHead) MoveAfter(vl List) *ListHead
- func (l *ListHead) MoveBefore(vl List) *ListHead
- func (l *ListHead) MoveToBack(vl List) *ListHead
- func (l *ListHead) MoveToFront(vl List) *ListHead
- func (head *ListHead) Next(opts ...TravOpt) (nextElement *ListHead)
- func (head *ListHead) Next1() (nextElement *ListHead, err error)
- func (head *ListHead) NextWithError() ListHeadWithError
- func (l *ListHead) P() string
- func (l *ListHead) Pp() string
- func (head *ListHead) Prev(opts ...TravOpt) (prev *ListHead)
- func (head *ListHead) PtrNext() **ListHead
- func (head *ListHead) Purge(opts ...func(*ListHead) error) (active *ListHead, purged *ListHead)
- func (l *ListHead) PushBack(vl List) *ListHead
- func (l *ListHead) PushBackList(oE List)
- func (l *ListHead) PushFront(vl List) *ListHead
- func (l *ListHead) PushFrontList(oE List)
- func (l *ListHead) Remove() *ListHead
- func (head *ListHead) Validate() error
- type ListHeadError
- type ListHeadWithError
- type ModeTraverse
- type OptMark
- type OptNewError
- type TravOpt
- type TraverseType
Constants ¶
const ( ErrTDeleteFirst = 1 << iota ErrTListNil ErrTEmpty ErrTMarked ErrTNextMarked ErrTNotAppend ErrTNotMarked ErrTCasConflictOnMark ErrTFirstMarked ErrTCasConflictOnAdd ErrTOverRetyry ErrTNoSafety ErrTNoContinous )
const UseRecoverState = true
Variables ¶
var ( MODE_CONCURRENT bool = false PANIC_NEXT_IS_MARKED bool = false )
var ( ErrDeleteFirst error = NewError(ErrTDeleteFirst, errors.New("first element cannot delete")) ErrListNil error = NewError(ErrTListNil, errors.New("list is nil")) ErrEmpty error = NewError(ErrTEmpty, errors.New("list is empty")) ErrMarked error = NewError(ErrTMarked, errors.New("element is marked")) ErrNextMarked error = NewError(ErrTNextMarked, errors.New("next element is marked")) ErrNotAppend error = NewError(ErrTNotAppend, errors.New("element cannot be append")) ErrNotMarked error = NewError(ErrTNotMarked, errors.New("elenment cannot be marked")) ErrCasConflictOnMark error = NewError(ErrTCasConflictOnMark, errors.New("cas conflict(fail mark)")) ErrFirstMarked error = NewError(ErrTFirstMarked, errors.New("first element is marked")) ErrNoSafetyOnAdd error = NewError(ErrTNoSafety, errors.New("element is not safety to append")) ErrNoContinous error = NewError(ErrTNoContinous, errors.New("element is not continus")) )
var RecoverStats map[string]int = map[string]int{}
Functions ¶
func AddRecoverState ¶ added in v0.3.1
func AddRecoverState(name string)
func ElementIsContainOf ¶
func ContainOf(head, elm *ListHead) bool {
func Error ¶ added in v0.3.1
func Error(oe error, opts ...OptNewError) error
func GetConcurrentMode ¶
func GetConcurrentMode() bool
func InitAfterSafety ¶ added in v0.3.1
func MarkListHead ¶ added in v0.3.1
func StoreListHead ¶ added in v0.3.1
Types ¶
type BoolAndError ¶ added in v0.3.1
type BoolAndError struct {
// contains filtered or unexported fields
}
func MakeBoolAndError ¶ added in v0.3.1
func MakeBoolAndError(t bool, e error) BoolAndError
type ListHead ¶
type ListHead struct {
// contains filtered or unexported fields
}
func (*ListHead) ActiveList ¶ added in v0.3.1
func (*ListHead) AppendWithRecover ¶ added in v0.3.1
func (*ListHead) AvoidNotAppend ¶ added in v0.3.1
func (*ListHead) DeleteElementWithCas ¶
func (*ListHead) DeleteWithCas ¶
func (*ListHead) DirectNext ¶
func (*ListHead) DumpAllWithMark ¶
func (*ListHead) InitAsEmpty ¶ added in v0.3.1
func (head *ListHead) InitAsEmpty()
func (*ListHead) InsertAfter ¶
func (*ListHead) InsertBefore ¶
func (*ListHead) IsFirstMarked ¶ added in v0.3.1
func (*ListHead) MarkForDelete ¶
func (*ListHead) MoveAfter ¶
MoveAfter ... moves element e to its new position after mark. If e is not an element of l, or e == mark, the list is not modified.
func (*ListHead) MoveBefore ¶
MoveBefore ... moves element e to its new position before mark. If e or mark is not an element of l, or e == mark, the list is not modified.
func (*ListHead) MoveToBack ¶
MoveToBack ... moves element e to later of list l. If e is not an element of l, the list is not modified.
func (*ListHead) MoveToFront ¶
MoveToFront ... moves element e to the front of list l. If e is not an element of l, the list is not modified.
func (*ListHead) NextWithError ¶ added in v0.3.1
func (head *ListHead) NextWithError() ListHeadWithError
func (*ListHead) PushBack ¶
PushBack ... inserts a new element e with value v at the back of list l and returns e.
func (*ListHead) PushBackList ¶
func (*ListHead) PushFront ¶
PushFront ... inserts a new value v at the front of list l and returns e.
func (*ListHead) PushFrontList ¶
type ListHeadError ¶ added in v0.3.1
func NewError ¶ added in v0.3.1
func NewError(t uint16, err error, opts ...OptNewError) *ListHeadError
type ListHeadWithError ¶ added in v0.3.1
type ListHeadWithError struct {
// contains filtered or unexported fields
}
func ListWithError ¶ added in v0.3.1
func ListWithError(head *ListHead, err error) ListHeadWithError
func (ListHeadWithError) Error ¶ added in v0.3.1
func (le ListHeadWithError) Error() string
func (ListHeadWithError) List ¶ added in v0.3.1
func (le ListHeadWithError) List() *ListHead
type ModeTraverse ¶ added in v0.3.1
type ModeTraverse struct {
// contains filtered or unexported fields
}
type OptNewError ¶ added in v0.3.1
type OptNewError func(e *ListHeadError)
func ErrorInfo ¶ added in v0.3.1
func ErrorInfo(s string) OptNewError
type TravOpt ¶ added in v0.3.1
type TravOpt func(*ModeTraverse)
func Trav ¶ added in v0.3.1
func Trav(t TraverseType) TravOpt
type TraverseType ¶ added in v0.3.1
type TraverseType byte
const ( TravDirect TraverseType = iota TravWaitNoMark TravSkipMark )