/usr/share/gocode/src/gopkg.in/eapache/channels.v1/native_channel.go is in golang-gopkg-eapache-channels.v1-dev 1.1.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | package channels
// NativeInChannel implements the InChannel interface by wrapping a native go write-only channel.
type NativeInChannel chan<- interface{}
func (ch NativeInChannel) In() chan<- interface{} {
return ch
}
func (ch NativeInChannel) Len() int {
return len(ch)
}
func (ch NativeInChannel) Cap() BufferCap {
return BufferCap(cap(ch))
}
func (ch NativeInChannel) Close() {
close(ch)
}
// NativeOutChannel implements the OutChannel interface by wrapping a native go read-only channel.
type NativeOutChannel <-chan interface{}
func (ch NativeOutChannel) Out() <-chan interface{} {
return ch
}
func (ch NativeOutChannel) Len() int {
return len(ch)
}
func (ch NativeOutChannel) Cap() BufferCap {
return BufferCap(cap(ch))
}
// NativeChannel implements the Channel interface by wrapping a native go channel.
type NativeChannel chan interface{}
// NewNativeChannel makes a new NativeChannel with the given buffer size. Just a convenience wrapper
// to avoid having to cast the result of make().
func NewNativeChannel(size BufferCap) NativeChannel {
return make(chan interface{}, size)
}
func (ch NativeChannel) In() chan<- interface{} {
return ch
}
func (ch NativeChannel) Out() <-chan interface{} {
return ch
}
func (ch NativeChannel) Len() int {
return len(ch)
}
func (ch NativeChannel) Cap() BufferCap {
return BufferCap(cap(ch))
}
func (ch NativeChannel) Close() {
close(ch)
}
// DeadChannel is a placeholder implementation of the Channel interface with no buffer
// that is never ready for reading or writing. Closing a dead channel is a no-op.
// Behaves almost like NativeChannel(nil) except that closing a nil NativeChannel will panic.
type DeadChannel struct{}
func NewDeadChannel() DeadChannel {
return DeadChannel{}
}
func (ch DeadChannel) In() chan<- interface{} {
return nil
}
func (ch DeadChannel) Out() <-chan interface{} {
return nil
}
func (ch DeadChannel) Len() int {
return 0
}
func (ch DeadChannel) Cap() BufferCap {
return BufferCap(0)
}
func (ch DeadChannel) Close() {
}
|