Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
0ce0c759
Unverified
Commit
0ce0c759
authored
Dec 07, 2016
by
Clayton Coleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bump:(github.com/armon/circbuf):bbbad097214e2918d8543d5201d12bfd7bca254d
parent
46bfa1ee
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
194 additions
and
0 deletions
+194
-0
Godeps.json
Godeps/Godeps.json
+4
-0
LICENSES
Godeps/LICENSES
+28
-0
.gitignore
vendor/github.com/armon/circbuf/.gitignore
+22
-0
LICENSE
vendor/github.com/armon/circbuf/LICENSE
+20
-0
README.md
vendor/github.com/armon/circbuf/README.md
+28
-0
circbuf.go
vendor/github.com/armon/circbuf/circbuf.go
+92
-0
No files found.
Godeps/Godeps.json
View file @
0ce0c759
...
...
@@ -129,6 +129,10 @@
"Rev"
:
"ab50d12e88f57788bf84b83fef2be236eb1fcc0b"
},
{
"ImportPath"
:
"github.com/armon/circbuf"
,
"Rev"
:
"bbbad097214e2918d8543d5201d12bfd7bca254d"
},
{
"ImportPath"
:
"github.com/asaskevich/govalidator"
,
"Comment"
:
"v4-12-g593d645"
,
"Rev"
:
"593d64559f7600f29581a3ee42177f5dbded27a9"
...
...
Godeps/LICENSES
View file @
0ce0c759
...
...
@@ -1547,6 +1547,34 @@ Apache License
================================================================================
=
vendor
/
github
.
com
/
armon
/
circbuf
licensed
under
:
=
The
MIT
License
(
MIT
)
Copyright
(
c
)
2013
Armon
Dadgar
Permission
is
hereby
granted
,
free
of
charge
,
to
any
person
obtaining
a
copy
of
this
software
and
associated
documentation
files
(
the
"Software"
),
to
deal
in
the
Software
without
restriction
,
including
without
limitation
the
rights
to
use
,
copy
,
modify
,
merge
,
publish
,
distribute
,
sublicense
,
and
/
or
sell
copies
of
the
Software
,
and
to
permit
persons
to
whom
the
Software
is
furnished
to
do
so
,
subject
to
the
following
conditions
:
The
above
copyright
notice
and
this
permission
notice
shall
be
included
in
all
copies
or
substantial
portions
of
the
Software
.
THE
SOFTWARE
IS
PROVIDED
"AS IS"
,
WITHOUT
WARRANTY
OF
ANY
KIND
,
EXPRESS
OR
IMPLIED
,
INCLUDING
BUT
NOT
LIMITED
TO
THE
WARRANTIES
OF
MERCHANTABILITY
,
FITNESS
FOR
A
PARTICULAR
PURPOSE
AND
NONINFRINGEMENT
.
IN
NO
EVENT
SHALL
THE
AUTHORS
OR
COPYRIGHT
HOLDERS
BE
LIABLE
FOR
ANY
CLAIM
,
DAMAGES
OR
OTHER
LIABILITY
,
WHETHER
IN
AN
ACTION
OF
CONTRACT
,
TORT
OR
OTHERWISE
,
ARISING
FROM
,
OUT
OF
OR
IN
CONNECTION
WITH
THE
SOFTWARE
OR
THE
USE
OR
OTHER
DEALINGS
IN
THE
SOFTWARE
.
=
vendor
/
github
.
com
/
armon
/
circbuf
/
LICENSE
d2d77030c0183e3d1e66d26dc1f243be
-
================================================================================
================================================================================
=
vendor
/
github
.
com
/
asaskevich
/
govalidator
licensed
under
:
=
The
MIT
License
(
MIT
)
vendor/github.com/armon/circbuf/.gitignore
0 → 100755
View file @
0ce0c759
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
vendor/github.com/armon/circbuf/LICENSE
0 → 100755
View file @
0ce0c759
The MIT License (MIT)
Copyright (c) 2013 Armon Dadgar
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
vendor/github.com/armon/circbuf/README.md
0 → 100644
View file @
0ce0c759
circbuf
=======
This repository provides the
`circbuf`
package. This provides a
`Buffer`
object
which is a circular (or ring) buffer. It has a fixed size, but can be written
to infinitely. Only the last
`size`
bytes are ever retained. The buffer implements
the
`io.Writer`
interface.
Documentation
=============
Full documentation can be found on
[
Godoc
](
http://godoc.org/github.com/armon/circbuf
)
Usage
=====
The
`circbuf`
package is very easy to use:
```
go
buf
,
_
:=
NewBuffer
(
6
)
buf
.
Write
([]
byte
(
"hello world"
))
if
string
(
buf
.
Bytes
())
!=
" world"
{
panic
(
"should only have last 6 bytes!"
)
}
```
vendor/github.com/armon/circbuf/circbuf.go
0 → 100644
View file @
0ce0c759
package
circbuf
import
(
"fmt"
)
// Buffer implements a circular buffer. It is a fixed size,
// and new writes overwrite older data, such that for a buffer
// of size N, for any amount of writes, only the last N bytes
// are retained.
type
Buffer
struct
{
data
[]
byte
size
int64
writeCursor
int64
written
int64
}
// NewBuffer creates a new buffer of a given size. The size
// must be greater than 0.
func
NewBuffer
(
size
int64
)
(
*
Buffer
,
error
)
{
if
size
<=
0
{
return
nil
,
fmt
.
Errorf
(
"Size must be positive"
)
}
b
:=
&
Buffer
{
size
:
size
,
data
:
make
([]
byte
,
size
),
}
return
b
,
nil
}
// Write writes up to len(buf) bytes to the internal ring,
// overriding older data if necessary.
func
(
b
*
Buffer
)
Write
(
buf
[]
byte
)
(
int
,
error
)
{
// Account for total bytes written
n
:=
len
(
buf
)
b
.
written
+=
int64
(
n
)
// If the buffer is larger than ours, then we only care
// about the last size bytes anyways
if
int64
(
n
)
>
b
.
size
{
buf
=
buf
[
int64
(
n
)
-
b
.
size
:
]
}
// Copy in place
remain
:=
b
.
size
-
b
.
writeCursor
copy
(
b
.
data
[
b
.
writeCursor
:
],
buf
)
if
int64
(
len
(
buf
))
>
remain
{
copy
(
b
.
data
,
buf
[
remain
:
])
}
// Update location of the cursor
b
.
writeCursor
=
((
b
.
writeCursor
+
int64
(
len
(
buf
)))
%
b
.
size
)
return
n
,
nil
}
// Size returns the size of the buffer
func
(
b
*
Buffer
)
Size
()
int64
{
return
b
.
size
}
// TotalWritten provides the total number of bytes written
func
(
b
*
Buffer
)
TotalWritten
()
int64
{
return
b
.
written
}
// Bytes provides a slice of the bytes written. This
// slice should not be written to.
func
(
b
*
Buffer
)
Bytes
()
[]
byte
{
switch
{
case
b
.
written
>=
b
.
size
&&
b
.
writeCursor
==
0
:
return
b
.
data
case
b
.
written
>
b
.
size
:
out
:=
make
([]
byte
,
b
.
size
)
copy
(
out
,
b
.
data
[
b
.
writeCursor
:
])
copy
(
out
[
b
.
size
-
b
.
writeCursor
:
],
b
.
data
[
:
b
.
writeCursor
])
return
out
default
:
return
b
.
data
[
:
b
.
writeCursor
]
}
}
// Reset resets the buffer so it has no content.
func
(
b
*
Buffer
)
Reset
()
{
b
.
writeCursor
=
0
b
.
written
=
0
}
// String returns the contents of the buffer as a string
func
(
b
*
Buffer
)
String
()
string
{
return
string
(
b
.
Bytes
())
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment