├── LICENSE ├── Makefile ├── README.md ├── cmd └── main.go ├── config └── config.go ├── server ├── client.go ├── handle.go └── server.go ├── store ├── cmd.go ├── db.go ├── db_badger.go ├── error.go ├── fsm.go ├── fsm_snapshot.go ├── kv.pb.go ├── kv.proto └── store.go └── vendor ├── github.com ├── AndreasBriese │ └── bbloom │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bbloom.go │ │ └── sipHash.go ├── armon │ └── go-metrics │ │ ├── LICENSE │ │ ├── README.md │ │ ├── const_unix.go │ │ ├── const_windows.go │ │ ├── inmem.go │ │ ├── inmem_endpoint.go │ │ ├── inmem_signal.go │ │ ├── metrics.go │ │ ├── sink.go │ │ ├── start.go │ │ ├── statsd.go │ │ └── statsite.go ├── boltdb │ └── bolt │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── appveyor.yml │ │ ├── bolt_386.go │ │ ├── bolt_amd64.go │ │ ├── bolt_arm.go │ │ ├── bolt_arm64.go │ │ ├── bolt_linux.go │ │ ├── bolt_openbsd.go │ │ ├── bolt_ppc.go │ │ ├── bolt_ppc64.go │ │ ├── bolt_ppc64le.go │ │ ├── bolt_s390x.go │ │ ├── bolt_unix.go │ │ ├── bolt_unix_solaris.go │ │ ├── bolt_windows.go │ │ ├── boltsync_unix.go │ │ ├── bucket.go │ │ ├── cursor.go │ │ ├── db.go │ │ ├── doc.go │ │ ├── errors.go │ │ ├── freelist.go │ │ ├── node.go │ │ ├── page.go │ │ └── tx.go ├── dgraph-io │ └── badger │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── appveyor.yml │ │ ├── backup.go │ │ ├── compaction.go │ │ ├── db.go │ │ ├── dir_unix.go │ │ ├── dir_windows.go │ │ ├── doc.go │ │ ├── errors.go │ │ ├── iterator.go │ │ ├── level_handler.go │ │ ├── levels.go │ │ ├── managed_db.go │ │ ├── manifest.go │ │ ├── options.go │ │ ├── options │ │ └── options.go │ │ ├── protos │ │ ├── backup.pb.go │ │ ├── backup.proto │ │ ├── gen.sh │ │ ├── manifest.pb.go │ │ └── manifest.proto │ │ ├── skl │ │ ├── README.md │ │ ├── arena.go │ │ └── skl.go │ │ ├── structs.go │ │ ├── table │ │ ├── README.md │ │ ├── builder.go │ │ ├── iterator.go │ │ └── table.go │ │ ├── test.sh │ │ ├── transaction.go │ │ ├── util.go │ │ ├── value.go │ │ └── y │ │ ├── error.go │ │ ├── file_dsync.go │ │ ├── file_nodsync.go │ │ ├── iterator.go │ │ ├── metrics.go │ │ ├── mmap_unix.go │ │ ├── mmap_windows.go │ │ ├── watermark.go │ │ └── y.go ├── dgryski │ └── go-farm │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── VERSION │ │ ├── basics.go │ │ ├── farmhashcc.go │ │ ├── farmhashmk.go │ │ ├── farmhashna.go │ │ ├── farmhashuo.go │ │ └── platform.go ├── golang │ └── protobuf │ │ ├── LICENSE │ │ └── proto │ │ ├── Makefile │ │ ├── clone.go │ │ ├── decode.go │ │ ├── encode.go │ │ ├── equal.go │ │ ├── extensions.go │ │ ├── lib.go │ │ ├── message_set.go │ │ ├── pointer_reflect.go │ │ ├── pointer_unsafe.go │ │ ├── properties.go │ │ ├── text.go │ │ └── text_parser.go ├── hashicorp │ ├── go-immutable-radix │ │ ├── LICENSE │ │ ├── README.md │ │ ├── edges.go │ │ ├── iradix.go │ │ ├── iter.go │ │ ├── node.go │ │ └── raw_iter.go │ ├── go-msgpack │ │ ├── LICENSE │ │ └── codec │ │ │ ├── 0doc.go │ │ │ ├── README.md │ │ │ ├── binc.go │ │ │ ├── decode.go │ │ │ ├── encode.go │ │ │ ├── helper.go │ │ │ ├── helper_internal.go │ │ │ ├── msgpack.go │ │ │ ├── msgpack_test.py │ │ │ ├── rpc.go │ │ │ ├── simple.go │ │ │ └── time.go │ ├── golang-lru │ │ ├── LICENSE │ │ └── simplelru │ │ │ ├── lru.go │ │ │ └── lru_interface.go │ ├── raft-boltdb │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── bolt_store.go │ │ └── util.go │ └── raft │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── api.go │ │ ├── commands.go │ │ ├── commitment.go │ │ ├── config.go │ │ ├── configuration.go │ │ ├── discard_snapshot.go │ │ ├── file_snapshot.go │ │ ├── fsm.go │ │ ├── future.go │ │ ├── inmem_snapshot.go │ │ ├── inmem_store.go │ │ ├── inmem_transport.go │ │ ├── log.go │ │ ├── log_cache.go │ │ ├── membership.md │ │ ├── net_transport.go │ │ ├── observer.go │ │ ├── peersjson.go │ │ ├── raft.go │ │ ├── replication.go │ │ ├── snapshot.go │ │ ├── stable.go │ │ ├── state.go │ │ ├── tag.sh │ │ ├── tcp_transport.go │ │ ├── transport.go │ │ └── util.go ├── pkg │ └── errors │ │ ├── LICENSE │ │ ├── README.md │ │ ├── appveyor.yml │ │ ├── errors.go │ │ └── stack.go ├── siddontang │ └── goredis │ │ ├── LICENSE │ │ ├── client.go │ │ ├── conn.go │ │ ├── doc.go │ │ ├── garyburd_license │ │ ├── reply.go │ │ └── resp.go └── yongman │ └── go │ └── goredis │ ├── LICENSE │ ├── client.go │ ├── conn.go │ ├── doc.go │ ├── garyburd_license │ ├── reply.go │ └── resp.go ├── golang.org └── x │ ├── LICENSE │ ├── PATENTS │ ├── net │ ├── LICENSE │ ├── PATENTS │ ├── context │ │ ├── context.go │ │ ├── go17.go │ │ ├── go19.go │ │ ├── pre_go17.go │ │ └── pre_go19.go │ ├── internal │ │ └── timeseries │ │ │ └── timeseries.go │ └── trace │ │ ├── events.go │ │ ├── histogram.go │ │ ├── trace.go │ │ ├── trace_go16.go │ │ └── trace_go17.go │ └── sys │ ├── LICENSE │ ├── PATENTS │ └── unix │ ├── README.md │ ├── asm_darwin_386.s │ ├── asm_darwin_amd64.s │ ├── asm_darwin_arm.s │ ├── asm_darwin_arm64.s │ ├── asm_dragonfly_amd64.s │ ├── asm_freebsd_386.s │ ├── asm_freebsd_amd64.s │ ├── asm_freebsd_arm.s │ ├── asm_linux_386.s │ ├── asm_linux_amd64.s │ ├── asm_linux_arm.s │ ├── asm_linux_arm64.s │ ├── asm_linux_mips64x.s │ ├── asm_linux_mipsx.s │ ├── asm_linux_ppc64x.s │ ├── asm_linux_s390x.s │ ├── asm_netbsd_386.s │ ├── asm_netbsd_amd64.s │ ├── asm_netbsd_arm.s │ ├── asm_openbsd_386.s │ ├── asm_openbsd_amd64.s │ ├── asm_openbsd_arm.s │ ├── asm_solaris_amd64.s │ ├── bluetooth_linux.go │ ├── cap_freebsd.go │ ├── constants.go │ ├── dev_darwin.go │ ├── dev_dragonfly.go │ ├── dev_freebsd.go │ ├── dev_linux.go │ ├── dev_netbsd.go │ ├── dev_openbsd.go │ ├── dirent.go │ ├── endian_big.go │ ├── endian_little.go │ ├── env_unix.go │ ├── env_unset.go │ ├── errors_freebsd_386.go │ ├── errors_freebsd_amd64.go │ ├── errors_freebsd_arm.go │ ├── file_unix.go │ ├── flock.go │ ├── flock_linux_32bit.go │ ├── gccgo.go │ ├── gccgo_c.c │ ├── gccgo_linux_amd64.go │ ├── mkall.sh │ ├── mkerrors.sh │ ├── mkpost.go │ ├── mksyscall.pl │ ├── mksyscall_solaris.pl │ ├── mksysctl_openbsd.pl │ ├── mksysnum_darwin.pl │ ├── mksysnum_dragonfly.pl │ ├── mksysnum_freebsd.pl │ ├── mksysnum_netbsd.pl │ ├── mksysnum_openbsd.pl │ ├── openbsd_pledge.go │ ├── pagesize_unix.go │ ├── race.go │ ├── race0.go │ ├── sockcmsg_linux.go │ ├── sockcmsg_unix.go │ ├── str.go │ ├── syscall.go │ ├── syscall_bsd.go │ ├── syscall_darwin.go │ ├── syscall_darwin_386.go │ ├── syscall_darwin_amd64.go │ ├── syscall_darwin_arm.go │ ├── syscall_darwin_arm64.go │ ├── syscall_dragonfly.go │ ├── syscall_dragonfly_amd64.go │ ├── syscall_freebsd.go │ ├── syscall_freebsd_386.go │ ├── syscall_freebsd_amd64.go │ ├── syscall_freebsd_arm.go │ ├── syscall_linux.go │ ├── syscall_linux_386.go │ ├── syscall_linux_amd64.go │ ├── syscall_linux_amd64_gc.go │ ├── syscall_linux_arm.go │ ├── syscall_linux_arm64.go │ ├── syscall_linux_mips64x.go │ ├── syscall_linux_mipsx.go │ ├── syscall_linux_ppc64x.go │ ├── syscall_linux_s390x.go │ ├── syscall_linux_sparc64.go │ ├── syscall_netbsd.go │ ├── syscall_netbsd_386.go │ ├── syscall_netbsd_amd64.go │ ├── syscall_netbsd_arm.go │ ├── syscall_no_getwd.go │ ├── syscall_openbsd.go │ ├── syscall_openbsd_386.go │ ├── syscall_openbsd_amd64.go │ ├── syscall_openbsd_arm.go │ ├── syscall_solaris.go │ ├── syscall_solaris_amd64.go │ ├── syscall_unix.go │ ├── syscall_unix_gc.go │ ├── timestruct.go │ ├── types_darwin.go │ ├── types_dragonfly.go │ ├── types_freebsd.go │ ├── types_netbsd.go │ ├── types_openbsd.go │ ├── types_solaris.go │ ├── zerrors_darwin_386.go │ ├── zerrors_darwin_amd64.go │ ├── zerrors_darwin_arm.go │ ├── zerrors_darwin_arm64.go │ ├── zerrors_dragonfly_amd64.go │ ├── zerrors_freebsd_386.go │ ├── zerrors_freebsd_amd64.go │ ├── zerrors_freebsd_arm.go │ ├── zerrors_linux_386.go │ ├── zerrors_linux_amd64.go │ ├── zerrors_linux_arm.go │ ├── zerrors_linux_arm64.go │ ├── zerrors_linux_mips.go │ ├── zerrors_linux_mips64.go │ ├── zerrors_linux_mips64le.go │ ├── zerrors_linux_mipsle.go │ ├── zerrors_linux_ppc64.go │ ├── zerrors_linux_ppc64le.go │ ├── zerrors_linux_s390x.go │ ├── zerrors_linux_sparc64.go │ ├── zerrors_netbsd_386.go │ ├── zerrors_netbsd_amd64.go │ ├── zerrors_netbsd_arm.go │ ├── zerrors_openbsd_386.go │ ├── zerrors_openbsd_amd64.go │ ├── zerrors_openbsd_arm.go │ ├── zerrors_solaris_amd64.go │ ├── zptrace386_linux.go │ ├── zptracearm_linux.go │ ├── zptracemips_linux.go │ ├── zptracemipsle_linux.go │ ├── zsyscall_darwin_386.go │ ├── zsyscall_darwin_amd64.go │ ├── zsyscall_darwin_arm.go │ ├── zsyscall_darwin_arm64.go │ ├── zsyscall_dragonfly_amd64.go │ ├── zsyscall_freebsd_386.go │ ├── zsyscall_freebsd_amd64.go │ ├── zsyscall_freebsd_arm.go │ ├── zsyscall_linux_386.go │ ├── zsyscall_linux_amd64.go │ ├── zsyscall_linux_arm.go │ ├── zsyscall_linux_arm64.go │ ├── zsyscall_linux_mips.go │ ├── zsyscall_linux_mips64.go │ ├── zsyscall_linux_mips64le.go │ ├── zsyscall_linux_mipsle.go │ ├── zsyscall_linux_ppc64.go │ ├── zsyscall_linux_ppc64le.go │ ├── zsyscall_linux_s390x.go │ ├── zsyscall_linux_sparc64.go │ ├── zsyscall_netbsd_386.go │ ├── zsyscall_netbsd_amd64.go │ ├── zsyscall_netbsd_arm.go │ ├── zsyscall_openbsd_386.go │ ├── zsyscall_openbsd_amd64.go │ ├── zsyscall_openbsd_arm.go │ ├── zsyscall_solaris_amd64.go │ ├── zsysctl_openbsd_386.go │ ├── zsysctl_openbsd_amd64.go │ ├── zsysctl_openbsd_arm.go │ ├── zsysnum_darwin_386.go │ ├── zsysnum_darwin_amd64.go │ ├── zsysnum_darwin_arm.go │ ├── zsysnum_darwin_arm64.go │ ├── zsysnum_dragonfly_amd64.go │ ├── zsysnum_freebsd_386.go │ ├── zsysnum_freebsd_amd64.go │ ├── zsysnum_freebsd_arm.go │ ├── zsysnum_linux_386.go │ ├── zsysnum_linux_amd64.go │ ├── zsysnum_linux_arm.go │ ├── zsysnum_linux_arm64.go │ ├── zsysnum_linux_mips.go │ ├── zsysnum_linux_mips64.go │ ├── zsysnum_linux_mips64le.go │ ├── zsysnum_linux_mipsle.go │ ├── zsysnum_linux_ppc64.go │ ├── zsysnum_linux_ppc64le.go │ ├── zsysnum_linux_s390x.go │ ├── zsysnum_linux_sparc64.go │ ├── zsysnum_netbsd_386.go │ ├── zsysnum_netbsd_amd64.go │ ├── zsysnum_netbsd_arm.go │ ├── zsysnum_openbsd_386.go │ ├── zsysnum_openbsd_amd64.go │ ├── zsysnum_openbsd_arm.go │ ├── zsysnum_solaris_amd64.go │ ├── ztypes_darwin_386.go │ ├── ztypes_darwin_amd64.go │ ├── ztypes_darwin_arm.go │ ├── ztypes_darwin_arm64.go │ ├── ztypes_dragonfly_amd64.go │ ├── ztypes_freebsd_386.go │ ├── ztypes_freebsd_amd64.go │ ├── ztypes_freebsd_arm.go │ ├── ztypes_linux_386.go │ ├── ztypes_linux_amd64.go │ ├── ztypes_linux_arm.go │ ├── ztypes_linux_arm64.go │ ├── ztypes_linux_mips.go │ ├── ztypes_linux_mips64.go │ ├── ztypes_linux_mips64le.go │ ├── ztypes_linux_mipsle.go │ ├── ztypes_linux_ppc64.go │ ├── ztypes_linux_ppc64le.go │ ├── ztypes_linux_s390x.go │ ├── ztypes_linux_sparc64.go │ ├── ztypes_netbsd_386.go │ ├── ztypes_netbsd_amd64.go │ ├── ztypes_netbsd_arm.go │ ├── ztypes_openbsd_386.go │ ├── ztypes_openbsd_amd64.go │ ├── ztypes_openbsd_arm.go │ └── ztypes_solaris_amd64.go └── vendor.json /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 yongman 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile 3 | # 4 | 5 | all: build 6 | 7 | build: 8 | go build -o bin/leto cmd/* 9 | 10 | # vim:ft=make 11 | # 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Leto 2 | 3 | ## 0. What is Leto mean? 4 | 5 | In Greek mythology, [Leto](https://en.wikipedia.org/wiki/Leto) (/ˈliːtoʊ/) is a daughter of the Titans Coeus and Phoebe, the sister of Asteria. 6 | 7 | ## 1. What is Leto? 8 | 9 | Leto is another reference example use of [Hashicorp Raft](https://github.com/hashicorp/raft). The API is [redis protocol](https://redis.io/topics/protocol) compatiable. 10 | 11 | [Raft](https://raft.github.io/) is a consensus algorithm that is designed to be easy to understand. It's equivalent to Paxos in fault-tolerance and performance. The difference is that it's decomposed into relatively independent subproblems, and it cleanly addresses all major pieces needed for practical systems. We hope Raft will make consensus available to a wider audience, and that this wider audience will be able to develop a variety of higher quality consensus-based systems than are available today. 12 | 13 | ## 2. Why do this? 14 | 15 | You can have better comprehension about how `raft protocal` works if you use it. This helps me a lot. 16 | 17 | 18 | ## 3. Run sample 19 | 20 | **3.1 show helps** 21 | ``` 22 | bin/leto -h 23 | Usage of bin/leto: 24 | -id string 25 | node id 26 | -join string 27 | join to already exist cluster 28 | -listen string 29 | server listen address (default ":5379") 30 | -raftbind string 31 | raft bus transport bind address (default ":15379") 32 | -raftdir string 33 | raft data directory (default "./") 34 | ``` 35 | 36 | **3.2 Start first node** 37 | 38 | ``` 39 | bin/leto -id id1 -raftdir ./id1 40 | ``` 41 | the first node will be listen user request and node join request in port `5379`, and use port `15379` for raft transport. 42 | 43 | **3.3 Start second node** 44 | 45 | ``` 46 | bin/leto -id id2 -raftdir ./id2 -listen ":6379" -raftbind ":16379" -join "127.0.0.1:5379" 47 | ``` 48 | 49 | **3.4 Start third node** 50 | 51 | ``` 52 | bin/leto -id id3 -raftdir ./id3 -listen ":7379" -raftbind ":17379" -join "127.0.0.1:5379" 53 | ``` 54 | 55 | **3.5 Test** 56 | 57 | Requst first node 58 | ``` 59 | redis-cli -p 5379 60 | 127.0.0.1:5379> set a b 61 | OK 62 | 127.0.0.1:5379> get a 63 | b 64 | 127.0.0.1:5379> 65 | ``` 66 | 67 | Write to second node, data has been replicated to this node. And it will return `not leader error` if write to it. 68 | 69 | ``` 70 | redis-cli -p 6379 71 | 127.0.0.1:6379> get a 72 | b 73 | 127.0.0.1:6379> set a b 74 | (error) not leader 75 | 127.0.0.1:6379> 76 | ``` 77 | 78 | Now, we `shutdown` the first node, the second node voted to be leader. 79 | ``` 80 | redis-cli -p 6379 81 | 127.0.0.1:6379> get a 82 | b 83 | 127.0.0.1:6379> set a b 84 | OK 85 | 127.0.0.1:6379> 86 | ``` 87 | 88 | ## 4. Support commands 89 | 90 | - GET 91 | - SET 92 | - DELETE 93 | - JOIN (communicate with peer when start node) 94 | - LEAVE (remove dead node from raft group) 95 | - PING 96 | - SNAPSHOT (trigger snapshot mannually) 97 | -------------------------------------------------------------------------------- /cmd/main.go: -------------------------------------------------------------------------------- 1 | // 2 | // main.go 3 | // Copyright (C) 2018 YanMing 4 | // 5 | // Distributed under terms of the MIT license. 6 | // 7 | 8 | package main 9 | 10 | import ( 11 | "flag" 12 | "os" 13 | "os/signal" 14 | "syscall" 15 | 16 | "github.com/yongman/leto/config" 17 | "github.com/yongman/leto/server" 18 | ) 19 | 20 | var ( 21 | listen string 22 | raftdir string 23 | raftbind string 24 | nodeID string 25 | join string 26 | ) 27 | 28 | func init() { 29 | flag.StringVar(&listen, "listen", ":5379", "server listen address") 30 | flag.StringVar(&raftdir, "raftdir", "./", "raft data directory") 31 | flag.StringVar(&raftbind, "raftbind", ":15379", "raft bus transport bind address") 32 | flag.StringVar(&nodeID, "id", "", "node id") 33 | flag.StringVar(&join, "join", "", "join to already exist cluster") 34 | } 35 | 36 | func main() { 37 | flag.Parse() 38 | 39 | var ( 40 | c *config.Config 41 | ) 42 | 43 | c = config.NewConfig(listen, raftdir, raftbind, nodeID, join) 44 | 45 | app := server.NewApp(c) 46 | 47 | quitCh := make(chan os.Signal, 1) 48 | signal.Notify(quitCh, os.Kill, os.Interrupt, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT) 49 | 50 | go app.Run() 51 | 52 | <-quitCh 53 | } 54 | -------------------------------------------------------------------------------- /config/config.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | type Config struct { 4 | Desc string 5 | Listen string 6 | RaftDir string 7 | RaftBind string 8 | Join string 9 | NodeID string 10 | } 11 | 12 | func NewConfig(listen, raftdir, raftbind, nodeid, join string) *Config { 13 | return &Config{ 14 | Listen: listen, 15 | RaftDir: raftdir, 16 | RaftBind: raftbind, 17 | NodeID: nodeid, 18 | Join: join, 19 | Desc: "", 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /server/handle.go: -------------------------------------------------------------------------------- 1 | // 2 | // handle.go 3 | // Copyright (C) 2018 YanMing 4 | // 5 | // Distributed under terms of the MIT license. 6 | // 7 | 8 | package server 9 | 10 | func (c *Client) handleJoin() error { 11 | if len(c.args) != 2 { 12 | return ErrParams 13 | } 14 | raftAddr := string(c.args[0]) 15 | nodeID := string(c.args[1]) 16 | 17 | return c.store.Join(nodeID, raftAddr) 18 | } 19 | 20 | func (c *Client) handleLeave() error { 21 | if len(c.args) != 1 { 22 | return ErrParams 23 | } 24 | 25 | nodeID := string(c.args[0]) 26 | 27 | return c.store.Leave(nodeID) 28 | } 29 | 30 | func (c *Client) handleSet() error { 31 | if len(c.args) != 2 { 32 | return ErrParams 33 | } 34 | key := string(c.args[0]) 35 | value := string(c.args[1]) 36 | err := c.store.Set(key, value) 37 | if err != nil { 38 | return err 39 | } 40 | return nil 41 | } 42 | 43 | func (c *Client) handleGet() (string, error) { 44 | if len(c.args) != 1 { 45 | return "", ErrParams 46 | } 47 | key := string(c.args[0]) 48 | v, err := c.store.Get(key) 49 | if err != nil { 50 | return "", err 51 | } 52 | 53 | return v, nil 54 | } 55 | 56 | func (c *Client) handleDel() error { 57 | if len(c.args) != 1 { 58 | return ErrParams 59 | } 60 | key := string(c.args[0]) 61 | err := c.store.Delete(key) 62 | if err != nil { 63 | return err 64 | } 65 | return nil 66 | } 67 | 68 | func (c *Client) handleSnapshot() error { 69 | if len(c.args) != 0 { 70 | return ErrParams 71 | } 72 | err := c.store.Snapshot() 73 | if err != nil { 74 | return err 75 | } 76 | 77 | return nil 78 | } 79 | -------------------------------------------------------------------------------- /server/server.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | "net" 7 | "os" 8 | 9 | "github.com/siddontang/goredis" 10 | "github.com/yongman/leto/config" 11 | "github.com/yongman/leto/store" 12 | ) 13 | 14 | type App struct { 15 | listener net.Listener 16 | 17 | // wrapper and manager for db instance 18 | store *store.Store 19 | 20 | logger *log.Logger 21 | } 22 | 23 | // initialize an app 24 | func NewApp(conf *config.Config) *App { 25 | var err error 26 | app := &App{} 27 | 28 | app.logger = log.New(os.Stderr, "[server] ", log.LstdFlags) 29 | 30 | app.store, err = store.NewStore(conf.RaftDir, conf.RaftBind) 31 | if err != nil { 32 | app.logger.Println(err.Error()) 33 | panic(err.Error()) 34 | } 35 | 36 | bootstrap := conf.Join == "" 37 | err = app.store.Open(bootstrap, conf.NodeID) 38 | if err != nil { 39 | app.logger.Println(err.Error()) 40 | panic(err.Error()) 41 | } 42 | 43 | if !bootstrap { 44 | // send join request to node already exists 45 | rc := goredis.NewClient(conf.Join, "") 46 | app.logger.Printf("join request send to %s", conf.Join) 47 | _, err := rc.Do("join", conf.RaftBind, conf.NodeID) 48 | if err != nil { 49 | app.logger.Println(err) 50 | } 51 | rc.Close() 52 | } 53 | 54 | app.listener, err = net.Listen("tcp", conf.Listen) 55 | app.logger.Printf("server listen in %s", conf.Listen) 56 | if err != nil { 57 | fmt.Println(err.Error()) 58 | } 59 | 60 | return app 61 | } 62 | 63 | func (app *App) Run() { 64 | // accept connections 65 | for { 66 | select { 67 | default: 68 | // accept new client connect and perform 69 | conn, err := app.listener.Accept() 70 | if err != nil { 71 | fmt.Println(err.Error()) 72 | continue 73 | } 74 | // handle conn 75 | ClientHandler(conn, app) 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /store/cmd.go: -------------------------------------------------------------------------------- 1 | // cmd.go 2 | // Copyright (C) 2018 YanMing 3 | // 4 | // Distributed under terms of the MIT license. 5 | // 6 | 7 | package store 8 | 9 | type command struct { 10 | Op string `json:"op,omitempty"` 11 | Key string `json:"key,omitempty"` 12 | Value string `json:"value,omitempty"` 13 | } 14 | 15 | func NewSetCommand(key, value string) *command { 16 | return &command{ 17 | Op: "set", 18 | Key: key, 19 | Value: value, 20 | } 21 | } 22 | 23 | func NewDeleteCommand(key string) *command { 24 | return &command{ 25 | Op: "delete", 26 | Key: key, 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /store/db.go: -------------------------------------------------------------------------------- 1 | // 2 | // db.go 3 | // Copyright (C) 2018 YanMing 4 | // 5 | // Distributed under terms of the MIT license. 6 | // 7 | 8 | package store 9 | 10 | type DB interface { 11 | Get(key []byte) ([]byte, error) 12 | Set(key, value []byte) error 13 | Delete(key []byte) (bool, error) 14 | 15 | SnapshotItems() <-chan DataItem 16 | 17 | Close() 18 | } 19 | 20 | type DataItem interface{} 21 | -------------------------------------------------------------------------------- /store/error.go: -------------------------------------------------------------------------------- 1 | // 2 | // error.go 3 | // Copyright (C) 2018 YanMing 4 | // 5 | // Distributed under terms of the MIT license. 6 | // 7 | 8 | package store 9 | 10 | import "errors" 11 | 12 | var ( 13 | ErrIterFinished = errors.New("ERR iteration finished successfully") 14 | ) 15 | -------------------------------------------------------------------------------- /store/fsm_snapshot.go: -------------------------------------------------------------------------------- 1 | // fsm_snapshot.go 2 | // Copyright (C) 2018 YanMing 3 | // 4 | // Distributed under terms of the MIT license. 5 | // 6 | 7 | package store 8 | 9 | import ( 10 | "log" 11 | 12 | "github.com/golang/protobuf/proto" 13 | "github.com/hashicorp/raft" 14 | ) 15 | 16 | type fsmSnapshot struct { 17 | db DB 18 | logger *log.Logger 19 | } 20 | 21 | // Persist data in specific type 22 | // kv item serialize in google protubuf 23 | func (f *fsmSnapshot) Persist(sink raft.SnapshotSink) error { 24 | f.logger.Printf("Persist action in fsmSnapshot") 25 | defer sink.Close() 26 | 27 | ch := f.db.SnapshotItems() 28 | 29 | keyCount := 0 30 | 31 | // read kv item from channel 32 | for { 33 | buff := proto.NewBuffer([]byte{}) 34 | 35 | dataItem := <-ch 36 | item := dataItem.(*KVItem) 37 | 38 | if item.IsFinished() { 39 | break 40 | } 41 | 42 | // create new protobuf item 43 | protoKVItem := &ProtoKVItem{ 44 | Key: item.key, 45 | Value: item.value, 46 | } 47 | 48 | keyCount = keyCount + 1 49 | 50 | // encode message 51 | buff.EncodeMessage(protoKVItem) 52 | 53 | if _, err := sink.Write(buff.Bytes()); err != nil { 54 | return err 55 | } 56 | } 57 | f.logger.Printf("Persist total %d keys", keyCount) 58 | 59 | return nil 60 | } 61 | 62 | func (f *fsmSnapshot) Release() { 63 | f.logger.Printf("Release action in fsmSnapshot") 64 | } 65 | -------------------------------------------------------------------------------- /store/kv.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // source: kv.proto 3 | 4 | /* 5 | Package store is a generated protocol buffer package. 6 | 7 | It is generated from these files: 8 | kv.proto 9 | 10 | It has these top-level messages: 11 | ProtoKVItem 12 | */ 13 | package store 14 | 15 | import proto "github.com/golang/protobuf/proto" 16 | import fmt "fmt" 17 | import math "math" 18 | 19 | // Reference imports to suppress errors if they are not otherwise used. 20 | var _ = proto.Marshal 21 | var _ = fmt.Errorf 22 | var _ = math.Inf 23 | 24 | // This is a compile-time assertion to ensure that this generated file 25 | // is compatible with the proto package it is being compiled against. 26 | // A compilation error at this line likely means your copy of the 27 | // proto package needs to be updated. 28 | const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package 29 | 30 | type ProtoKVItem struct { 31 | Key []byte `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` 32 | Value []byte `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` 33 | XXX_unrecognized []byte `json:"-"` 34 | } 35 | 36 | func (m *ProtoKVItem) Reset() { *m = ProtoKVItem{} } 37 | func (m *ProtoKVItem) String() string { return proto.CompactTextString(m) } 38 | func (*ProtoKVItem) ProtoMessage() {} 39 | func (*ProtoKVItem) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } 40 | 41 | func (m *ProtoKVItem) GetKey() []byte { 42 | if m != nil { 43 | return m.Key 44 | } 45 | return nil 46 | } 47 | 48 | func (m *ProtoKVItem) GetValue() []byte { 49 | if m != nil { 50 | return m.Value 51 | } 52 | return nil 53 | } 54 | 55 | func init() { 56 | proto.RegisterType((*ProtoKVItem)(nil), "store.ProtoKVItem") 57 | } 58 | 59 | func init() { proto.RegisterFile("kv.proto", fileDescriptor0) } 60 | 61 | var fileDescriptor0 = []byte{ 62 | // 84 bytes of a gzipped FileDescriptorProto 63 | 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0xc8, 0x2e, 0xd3, 0x2b, 64 | 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2d, 0x2e, 0xc9, 0x2f, 0x4a, 0x55, 0x32, 0xe5, 0xe2, 0x0e, 65 | 0x00, 0xf1, 0xbd, 0xc3, 0x3c, 0x4b, 0x52, 0x73, 0x85, 0x04, 0xb8, 0x98, 0xb3, 0x53, 0x2b, 0x25, 66 | 0x18, 0x15, 0x18, 0x35, 0x78, 0x82, 0x40, 0x4c, 0x21, 0x11, 0x2e, 0xd6, 0xb2, 0xc4, 0x9c, 0xd2, 67 | 0x54, 0x09, 0x26, 0xb0, 0x18, 0x84, 0x03, 0x08, 0x00, 0x00, 0xff, 0xff, 0xb6, 0xf7, 0xfa, 0x56, 68 | 0x48, 0x00, 0x00, 0x00, 69 | } 70 | -------------------------------------------------------------------------------- /store/kv.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | package store; 3 | 4 | message ProtoKVItem { 5 | optional bytes key = 1; 6 | optional bytes value = 2; 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/AndreasBriese/bbloom/LICENSE: -------------------------------------------------------------------------------- 1 | bbloom.go 2 | 3 | // The MIT License (MIT) 4 | // Copyright (c) 2014 Andreas Briese, eduToolbox@Bri-C GmbH, Sarstedt 5 | 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | siphash.go 24 | 25 | // https://github.com/dchest/siphash 26 | // 27 | // Written in 2012 by Dmitry Chestnykh. 28 | // 29 | // To the extent possible under law, the author have dedicated all copyright 30 | // and related and neighboring rights to this software to the public domain 31 | // worldwide. This software is distributed without any warranty. 32 | // http://creativecommons.org/publicdomain/zero/1.0/ 33 | // 34 | // Package siphash implements SipHash-2-4, a fast short-input PRF 35 | // created by Jean-Philippe Aumasson and Daniel J. Bernstein. 36 | -------------------------------------------------------------------------------- /vendor/github.com/armon/go-metrics/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Armon Dadgar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/armon/go-metrics/const_unix.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package metrics 4 | 5 | import ( 6 | "syscall" 7 | ) 8 | 9 | const ( 10 | // DefaultSignal is used with DefaultInmemSignal 11 | DefaultSignal = syscall.SIGUSR1 12 | ) 13 | -------------------------------------------------------------------------------- /vendor/github.com/armon/go-metrics/const_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package metrics 4 | 5 | import ( 6 | "syscall" 7 | ) 8 | 9 | const ( 10 | // DefaultSignal is used with DefaultInmemSignal 11 | // Windows has no SIGUSR1, use SIGBREAK 12 | DefaultSignal = syscall.Signal(21) 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Ben Johnson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/Makefile: -------------------------------------------------------------------------------- 1 | BRANCH=`git rev-parse --abbrev-ref HEAD` 2 | COMMIT=`git rev-parse --short HEAD` 3 | GOLDFLAGS="-X main.branch $(BRANCH) -X main.commit $(COMMIT)" 4 | 5 | default: build 6 | 7 | race: 8 | @go test -v -race -test.run="TestSimulate_(100op|1000op)" 9 | 10 | # go get github.com/kisielk/errcheck 11 | errcheck: 12 | @errcheck -ignorepkg=bytes -ignore=os:Remove github.com/boltdb/bolt 13 | 14 | test: 15 | @go test -v -cover . 16 | @go test -v ./cmd/bolt 17 | 18 | .PHONY: fmt test 19 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: "{build}" 2 | 3 | os: Windows Server 2012 R2 4 | 5 | clone_folder: c:\gopath\src\github.com\boltdb\bolt 6 | 7 | environment: 8 | GOPATH: c:\gopath 9 | 10 | install: 11 | - echo %PATH% 12 | - echo %GOPATH% 13 | - go version 14 | - go env 15 | - go get -v -t ./... 16 | 17 | build_script: 18 | - go test -v ./... 19 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_386.go: -------------------------------------------------------------------------------- 1 | package bolt 2 | 3 | // maxMapSize represents the largest mmap size supported by Bolt. 4 | const maxMapSize = 0x7FFFFFFF // 2GB 5 | 6 | // maxAllocSize is the size used when creating array pointers. 7 | const maxAllocSize = 0xFFFFFFF 8 | 9 | // Are unaligned load/stores broken on this arch? 10 | var brokenUnaligned = false 11 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_amd64.go: -------------------------------------------------------------------------------- 1 | package bolt 2 | 3 | // maxMapSize represents the largest mmap size supported by Bolt. 4 | const maxMapSize = 0xFFFFFFFFFFFF // 256TB 5 | 6 | // maxAllocSize is the size used when creating array pointers. 7 | const maxAllocSize = 0x7FFFFFFF 8 | 9 | // Are unaligned load/stores broken on this arch? 10 | var brokenUnaligned = false 11 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_arm.go: -------------------------------------------------------------------------------- 1 | package bolt 2 | 3 | import "unsafe" 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0x7FFFFFFF // 2GB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0xFFFFFFF 10 | 11 | // Are unaligned load/stores broken on this arch? 12 | var brokenUnaligned bool 13 | 14 | func init() { 15 | // Simple check to see whether this arch handles unaligned load/stores 16 | // correctly. 17 | 18 | // ARM9 and older devices require load/stores to be from/to aligned 19 | // addresses. If not, the lower 2 bits are cleared and that address is 20 | // read in a jumbled up order. 21 | 22 | // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka15414.html 23 | 24 | raw := [6]byte{0xfe, 0xef, 0x11, 0x22, 0x22, 0x11} 25 | val := *(*uint32)(unsafe.Pointer(uintptr(unsafe.Pointer(&raw)) + 2)) 26 | 27 | brokenUnaligned = val != 0x11222211 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_arm64.go: -------------------------------------------------------------------------------- 1 | // +build arm64 2 | 3 | package bolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0xFFFFFFFFFFFF // 256TB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0x7FFFFFFF 10 | 11 | // Are unaligned load/stores broken on this arch? 12 | var brokenUnaligned = false 13 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_linux.go: -------------------------------------------------------------------------------- 1 | package bolt 2 | 3 | import ( 4 | "syscall" 5 | ) 6 | 7 | // fdatasync flushes written data to a file descriptor. 8 | func fdatasync(db *DB) error { 9 | return syscall.Fdatasync(int(db.file.Fd())) 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_openbsd.go: -------------------------------------------------------------------------------- 1 | package bolt 2 | 3 | import ( 4 | "syscall" 5 | "unsafe" 6 | ) 7 | 8 | const ( 9 | msAsync = 1 << iota // perform asynchronous writes 10 | msSync // perform synchronous writes 11 | msInvalidate // invalidate cached data 12 | ) 13 | 14 | func msync(db *DB) error { 15 | _, _, errno := syscall.Syscall(syscall.SYS_MSYNC, uintptr(unsafe.Pointer(db.data)), uintptr(db.datasz), msInvalidate) 16 | if errno != 0 { 17 | return errno 18 | } 19 | return nil 20 | } 21 | 22 | func fdatasync(db *DB) error { 23 | if db.data != nil { 24 | return msync(db) 25 | } 26 | return db.file.Sync() 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_ppc.go: -------------------------------------------------------------------------------- 1 | // +build ppc 2 | 3 | package bolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0x7FFFFFFF // 2GB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0xFFFFFFF 10 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_ppc64.go: -------------------------------------------------------------------------------- 1 | // +build ppc64 2 | 3 | package bolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0xFFFFFFFFFFFF // 256TB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0x7FFFFFFF 10 | 11 | // Are unaligned load/stores broken on this arch? 12 | var brokenUnaligned = false 13 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_ppc64le.go: -------------------------------------------------------------------------------- 1 | // +build ppc64le 2 | 3 | package bolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0xFFFFFFFFFFFF // 256TB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0x7FFFFFFF 10 | 11 | // Are unaligned load/stores broken on this arch? 12 | var brokenUnaligned = false 13 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_s390x.go: -------------------------------------------------------------------------------- 1 | // +build s390x 2 | 3 | package bolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0xFFFFFFFFFFFF // 256TB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0x7FFFFFFF 10 | 11 | // Are unaligned load/stores broken on this arch? 12 | var brokenUnaligned = false 13 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_unix.go: -------------------------------------------------------------------------------- 1 | // +build !windows,!plan9,!solaris 2 | 3 | package bolt 4 | 5 | import ( 6 | "fmt" 7 | "os" 8 | "syscall" 9 | "time" 10 | "unsafe" 11 | ) 12 | 13 | // flock acquires an advisory lock on a file descriptor. 14 | func flock(db *DB, mode os.FileMode, exclusive bool, timeout time.Duration) error { 15 | var t time.Time 16 | for { 17 | // If we're beyond our timeout then return an error. 18 | // This can only occur after we've attempted a flock once. 19 | if t.IsZero() { 20 | t = time.Now() 21 | } else if timeout > 0 && time.Since(t) > timeout { 22 | return ErrTimeout 23 | } 24 | flag := syscall.LOCK_SH 25 | if exclusive { 26 | flag = syscall.LOCK_EX 27 | } 28 | 29 | // Otherwise attempt to obtain an exclusive lock. 30 | err := syscall.Flock(int(db.file.Fd()), flag|syscall.LOCK_NB) 31 | if err == nil { 32 | return nil 33 | } else if err != syscall.EWOULDBLOCK { 34 | return err 35 | } 36 | 37 | // Wait for a bit and try again. 38 | time.Sleep(50 * time.Millisecond) 39 | } 40 | } 41 | 42 | // funlock releases an advisory lock on a file descriptor. 43 | func funlock(db *DB) error { 44 | return syscall.Flock(int(db.file.Fd()), syscall.LOCK_UN) 45 | } 46 | 47 | // mmap memory maps a DB's data file. 48 | func mmap(db *DB, sz int) error { 49 | // Map the data file to memory. 50 | b, err := syscall.Mmap(int(db.file.Fd()), 0, sz, syscall.PROT_READ, syscall.MAP_SHARED|db.MmapFlags) 51 | if err != nil { 52 | return err 53 | } 54 | 55 | // Advise the kernel that the mmap is accessed randomly. 56 | if err := madvise(b, syscall.MADV_RANDOM); err != nil { 57 | return fmt.Errorf("madvise: %s", err) 58 | } 59 | 60 | // Save the original byte slice and convert to a byte array pointer. 61 | db.dataref = b 62 | db.data = (*[maxMapSize]byte)(unsafe.Pointer(&b[0])) 63 | db.datasz = sz 64 | return nil 65 | } 66 | 67 | // munmap unmaps a DB's data file from memory. 68 | func munmap(db *DB) error { 69 | // Ignore the unmap if we have no mapped data. 70 | if db.dataref == nil { 71 | return nil 72 | } 73 | 74 | // Unmap using the original byte slice. 75 | err := syscall.Munmap(db.dataref) 76 | db.dataref = nil 77 | db.data = nil 78 | db.datasz = 0 79 | return err 80 | } 81 | 82 | // NOTE: This function is copied from stdlib because it is not available on darwin. 83 | func madvise(b []byte, advice int) (err error) { 84 | _, _, e1 := syscall.Syscall(syscall.SYS_MADVISE, uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), uintptr(advice)) 85 | if e1 != 0 { 86 | err = e1 87 | } 88 | return 89 | } 90 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_unix_solaris.go: -------------------------------------------------------------------------------- 1 | package bolt 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "syscall" 7 | "time" 8 | "unsafe" 9 | 10 | "golang.org/x/sys/unix" 11 | ) 12 | 13 | // flock acquires an advisory lock on a file descriptor. 14 | func flock(db *DB, mode os.FileMode, exclusive bool, timeout time.Duration) error { 15 | var t time.Time 16 | for { 17 | // If we're beyond our timeout then return an error. 18 | // This can only occur after we've attempted a flock once. 19 | if t.IsZero() { 20 | t = time.Now() 21 | } else if timeout > 0 && time.Since(t) > timeout { 22 | return ErrTimeout 23 | } 24 | var lock syscall.Flock_t 25 | lock.Start = 0 26 | lock.Len = 0 27 | lock.Pid = 0 28 | lock.Whence = 0 29 | lock.Pid = 0 30 | if exclusive { 31 | lock.Type = syscall.F_WRLCK 32 | } else { 33 | lock.Type = syscall.F_RDLCK 34 | } 35 | err := syscall.FcntlFlock(db.file.Fd(), syscall.F_SETLK, &lock) 36 | if err == nil { 37 | return nil 38 | } else if err != syscall.EAGAIN { 39 | return err 40 | } 41 | 42 | // Wait for a bit and try again. 43 | time.Sleep(50 * time.Millisecond) 44 | } 45 | } 46 | 47 | // funlock releases an advisory lock on a file descriptor. 48 | func funlock(db *DB) error { 49 | var lock syscall.Flock_t 50 | lock.Start = 0 51 | lock.Len = 0 52 | lock.Type = syscall.F_UNLCK 53 | lock.Whence = 0 54 | return syscall.FcntlFlock(uintptr(db.file.Fd()), syscall.F_SETLK, &lock) 55 | } 56 | 57 | // mmap memory maps a DB's data file. 58 | func mmap(db *DB, sz int) error { 59 | // Map the data file to memory. 60 | b, err := unix.Mmap(int(db.file.Fd()), 0, sz, syscall.PROT_READ, syscall.MAP_SHARED|db.MmapFlags) 61 | if err != nil { 62 | return err 63 | } 64 | 65 | // Advise the kernel that the mmap is accessed randomly. 66 | if err := unix.Madvise(b, syscall.MADV_RANDOM); err != nil { 67 | return fmt.Errorf("madvise: %s", err) 68 | } 69 | 70 | // Save the original byte slice and convert to a byte array pointer. 71 | db.dataref = b 72 | db.data = (*[maxMapSize]byte)(unsafe.Pointer(&b[0])) 73 | db.datasz = sz 74 | return nil 75 | } 76 | 77 | // munmap unmaps a DB's data file from memory. 78 | func munmap(db *DB) error { 79 | // Ignore the unmap if we have no mapped data. 80 | if db.dataref == nil { 81 | return nil 82 | } 83 | 84 | // Unmap using the original byte slice. 85 | err := unix.Munmap(db.dataref) 86 | db.dataref = nil 87 | db.data = nil 88 | db.datasz = 0 89 | return err 90 | } 91 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/boltsync_unix.go: -------------------------------------------------------------------------------- 1 | // +build !windows,!plan9,!linux,!openbsd 2 | 3 | package bolt 4 | 5 | // fdatasync flushes written data to a file descriptor. 6 | func fdatasync(db *DB) error { 7 | return db.file.Sync() 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package bolt implements a low-level key/value store in pure Go. It supports 3 | fully serializable transactions, ACID semantics, and lock-free MVCC with 4 | multiple readers and a single writer. Bolt can be used for projects that 5 | want a simple data store without the need to add large dependencies such as 6 | Postgres or MySQL. 7 | 8 | Bolt is a single-level, zero-copy, B+tree data store. This means that Bolt is 9 | optimized for fast read access and does not require recovery in the event of a 10 | system crash. Transactions which have not finished committing will simply be 11 | rolled back in the event of a crash. 12 | 13 | The design of Bolt is based on Howard Chu's LMDB database project. 14 | 15 | Bolt currently works on Windows, Mac OS X, and Linux. 16 | 17 | 18 | Basics 19 | 20 | There are only a few types in Bolt: DB, Bucket, Tx, and Cursor. The DB is 21 | a collection of buckets and is represented by a single file on disk. A bucket is 22 | a collection of unique keys that are associated with values. 23 | 24 | Transactions provide either read-only or read-write access to the database. 25 | Read-only transactions can retrieve key/value pairs and can use Cursors to 26 | iterate over the dataset sequentially. Read-write transactions can create and 27 | delete buckets and can insert and remove keys. Only one read-write transaction 28 | is allowed at a time. 29 | 30 | 31 | Caveats 32 | 33 | The database uses a read-only, memory-mapped data file to ensure that 34 | applications cannot corrupt the database, however, this means that keys and 35 | values returned from Bolt cannot be changed. Writing to a read-only byte slice 36 | will cause Go to panic. 37 | 38 | Keys and values retrieved from the database are only valid for the life of 39 | the transaction. When used outside the transaction, these byte slices can 40 | point to different data or can point to invalid memory which will cause a panic. 41 | 42 | 43 | */ 44 | package bolt 45 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/errors.go: -------------------------------------------------------------------------------- 1 | package bolt 2 | 3 | import "errors" 4 | 5 | // These errors can be returned when opening or calling methods on a DB. 6 | var ( 7 | // ErrDatabaseNotOpen is returned when a DB instance is accessed before it 8 | // is opened or after it is closed. 9 | ErrDatabaseNotOpen = errors.New("database not open") 10 | 11 | // ErrDatabaseOpen is returned when opening a database that is 12 | // already open. 13 | ErrDatabaseOpen = errors.New("database already open") 14 | 15 | // ErrInvalid is returned when both meta pages on a database are invalid. 16 | // This typically occurs when a file is not a bolt database. 17 | ErrInvalid = errors.New("invalid database") 18 | 19 | // ErrVersionMismatch is returned when the data file was created with a 20 | // different version of Bolt. 21 | ErrVersionMismatch = errors.New("version mismatch") 22 | 23 | // ErrChecksum is returned when either meta page checksum does not match. 24 | ErrChecksum = errors.New("checksum error") 25 | 26 | // ErrTimeout is returned when a database cannot obtain an exclusive lock 27 | // on the data file after the timeout passed to Open(). 28 | ErrTimeout = errors.New("timeout") 29 | ) 30 | 31 | // These errors can occur when beginning or committing a Tx. 32 | var ( 33 | // ErrTxNotWritable is returned when performing a write operation on a 34 | // read-only transaction. 35 | ErrTxNotWritable = errors.New("tx not writable") 36 | 37 | // ErrTxClosed is returned when committing or rolling back a transaction 38 | // that has already been committed or rolled back. 39 | ErrTxClosed = errors.New("tx closed") 40 | 41 | // ErrDatabaseReadOnly is returned when a mutating transaction is started on a 42 | // read-only database. 43 | ErrDatabaseReadOnly = errors.New("database is in read-only mode") 44 | ) 45 | 46 | // These errors can occur when putting or deleting a value or a bucket. 47 | var ( 48 | // ErrBucketNotFound is returned when trying to access a bucket that has 49 | // not been created yet. 50 | ErrBucketNotFound = errors.New("bucket not found") 51 | 52 | // ErrBucketExists is returned when creating a bucket that already exists. 53 | ErrBucketExists = errors.New("bucket already exists") 54 | 55 | // ErrBucketNameRequired is returned when creating a bucket with a blank name. 56 | ErrBucketNameRequired = errors.New("bucket name required") 57 | 58 | // ErrKeyRequired is returned when inserting a zero-length key. 59 | ErrKeyRequired = errors.New("key required") 60 | 61 | // ErrKeyTooLarge is returned when inserting a key that is larger than MaxKeySize. 62 | ErrKeyTooLarge = errors.New("key too large") 63 | 64 | // ErrValueTooLarge is returned when inserting a value that is larger than MaxValueSize. 65 | ErrValueTooLarge = errors.New("value too large") 66 | 67 | // ErrIncompatibleValue is returned when trying create or delete a bucket 68 | // on an existing non-bucket key or when trying to create or delete a 69 | // non-bucket key on an existing bucket key. 70 | ErrIncompatibleValue = errors.New("incompatible value") 71 | ) 72 | -------------------------------------------------------------------------------- /vendor/github.com/dgraph-io/badger/appveyor.yml: -------------------------------------------------------------------------------- 1 | # version format 2 | version: "{build}" 3 | 4 | # Operating system (build VM template) 5 | os: Windows Server 2012 R2 6 | 7 | # Platform. 8 | platform: x64 9 | 10 | clone_folder: c:\gopath\src\github.com\dgraph-io\badger 11 | 12 | # Environment variables 13 | environment: 14 | GOVERSION: 1.8.3 15 | GOPATH: c:\gopath 16 | 17 | # scripts that run after cloning repository 18 | install: 19 | - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% 20 | - go version 21 | - go env 22 | - python --version 23 | 24 | # To run your custom scripts instead of automatic MSBuild 25 | build_script: 26 | # We need to disable firewall - https://github.com/appveyor/ci/issues/1579#issuecomment-309830648 27 | - ps: Disable-NetFirewallRule -DisplayName 'File and Printer Sharing (SMB-Out)' 28 | - cd c:\gopath\src\github.com\dgraph-io\badger 29 | - git branch 30 | - go get -t ./... 31 | 32 | # To run your custom scripts instead of automatic tests 33 | test_script: 34 | # Unit tests 35 | - ps: Add-AppveyorTest "Unit Tests" -Outcome Running 36 | - go test -v github.com/dgraph-io/badger/... 37 | - go test -v -vlog_mmap=false github.com/dgraph-io/badger/... 38 | - ps: Update-AppveyorTest "Unit Tests" -Outcome Passed 39 | 40 | notifications: 41 | - provider: Email 42 | to: 43 | - pawan@dgraph.io 44 | on_build_failure: true 45 | on_build_status_changed: true 46 | # to disable deployment 47 | deploy: off 48 | 49 | -------------------------------------------------------------------------------- /vendor/github.com/dgraph-io/badger/dir_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | /* 4 | * Copyright 2017 Dgraph Labs, Inc. and Contributors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package badger 20 | 21 | // OpenDir opens a directory in windows with write access for syncing. 22 | import ( 23 | "fmt" 24 | "os" 25 | "path/filepath" 26 | "syscall" 27 | 28 | "github.com/pkg/errors" 29 | ) 30 | 31 | func openDir(path string) (*os.File, error) { 32 | fd, err := openDirWin(path) 33 | if err != nil { 34 | return nil, err 35 | } 36 | return os.NewFile(uintptr(fd), path), nil 37 | } 38 | 39 | func openDirWin(path string) (fd syscall.Handle, err error) { 40 | if len(path) == 0 { 41 | return syscall.InvalidHandle, syscall.ERROR_FILE_NOT_FOUND 42 | } 43 | pathp, err := syscall.UTF16PtrFromString(path) 44 | if err != nil { 45 | return syscall.InvalidHandle, err 46 | } 47 | access := uint32(syscall.GENERIC_READ | syscall.GENERIC_WRITE) 48 | sharemode := uint32(syscall.FILE_SHARE_READ | syscall.FILE_SHARE_WRITE) 49 | createmode := uint32(syscall.OPEN_EXISTING) 50 | fl := uint32(syscall.FILE_FLAG_BACKUP_SEMANTICS) 51 | return syscall.CreateFile(pathp, access, sharemode, nil, createmode, fl, 0) 52 | } 53 | 54 | // DirectoryLockGuard holds a lock on the directory. 55 | type directoryLockGuard struct { 56 | path string 57 | } 58 | 59 | // AcquireDirectoryLock acquires exclusive access to a directory. 60 | func acquireDirectoryLock(dirPath string, pidFileName string, readOnly bool) (*directoryLockGuard, error) { 61 | if readOnly { 62 | return nil, ErrWindowsNotSupported 63 | } 64 | 65 | // Convert to absolute path so that Release still works even if we do an unbalanced 66 | // chdir in the meantime. 67 | absLockFilePath, err := filepath.Abs(filepath.Join(dirPath, pidFileName)) 68 | if err != nil { 69 | return nil, errors.Wrap(err, "Cannot get absolute path for pid lock file") 70 | } 71 | 72 | f, err := os.OpenFile(absLockFilePath, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0666) 73 | if err != nil { 74 | return nil, errors.Wrapf(err, 75 | "Cannot create pid lock file %q. Another process is using this Badger database", 76 | absLockFilePath) 77 | } 78 | _, err = fmt.Fprintf(f, "%d\n", os.Getpid()) 79 | closeErr := f.Close() 80 | if err != nil { 81 | return nil, errors.Wrap(err, "Cannot write to pid lock file") 82 | } 83 | if closeErr != nil { 84 | return nil, errors.Wrap(closeErr, "Cannot close pid lock file") 85 | } 86 | return &directoryLockGuard{path: absLockFilePath}, nil 87 | } 88 | 89 | // Release removes the directory lock. 90 | func (g *directoryLockGuard) release() error { 91 | path := g.path 92 | g.path = "" 93 | return os.Remove(path) 94 | } 95 | -------------------------------------------------------------------------------- /vendor/github.com/dgraph-io/badger/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package badger implements an embeddable, simple and fast key-value database, 3 | written in pure Go. It is designed to be highly performant for both reads and 4 | writes simultaneously. Badger uses Multi-Version Concurrency Control (MVCC), and 5 | supports transactions. It runs transactions concurrently, with serializable 6 | snapshot isolation guarantees. 7 | 8 | Badger uses an LSM tree along with a value log to separate keys from values, 9 | hence reducing both write amplification and the size of the LSM tree. This 10 | allows LSM tree to be served entirely from RAM, while the values are served 11 | from SSD. 12 | 13 | 14 | Usage 15 | 16 | Badger has the following main types: DB, Txn, Item and Iterator. DB contains 17 | keys that are associated with values. It must be opened with the appropriate 18 | options before it can be accessed. 19 | 20 | All operations happen inside a Txn. Txn represents a transaction, which can 21 | be read-only or read-write. Read-only transactions can read values for a 22 | given key (which are returned inside an Item), or iterate over a set of 23 | key-value pairs using an Iterator (which are returned as Item type values as 24 | well). Read-write transactions can also update and delete keys from the DB. 25 | 26 | See the examples for more usage details. 27 | */ 28 | package badger 29 | -------------------------------------------------------------------------------- /vendor/github.com/dgraph-io/badger/options/options.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Dgraph Labs, Inc. and Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package options 18 | 19 | // FileLoadingMode specifies how data in LSM table files and value log files should 20 | // be loaded. 21 | type FileLoadingMode int 22 | 23 | const ( 24 | // FileIO indicates that files must be loaded using standard I/O 25 | FileIO FileLoadingMode = iota 26 | // LoadToRAM indicates that file must be loaded into RAM 27 | LoadToRAM 28 | // MemoryMap indicates that that the file must be memory-mapped 29 | MemoryMap 30 | ) 31 | -------------------------------------------------------------------------------- /vendor/github.com/dgraph-io/badger/protos/backup.proto: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Dgraph Labs, Inc. and Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Use protos/gen.sh to generate .pb.go files. 18 | syntax = "proto3"; 19 | 20 | package protos; 21 | 22 | message KVPair { 23 | bytes key = 1; 24 | bytes value = 2; 25 | bytes userMeta = 3; 26 | uint64 version = 4; 27 | uint64 expires_at = 5; 28 | } -------------------------------------------------------------------------------- /vendor/github.com/dgraph-io/badger/protos/gen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # You might need to go get -v github.com/gogo/protobuf/... 4 | 5 | protos=${GOPATH-$HOME/go}/src/github.com/dgraph-io/badger/protos 6 | pushd $protos > /dev/null 7 | protoc --gofast_out=plugins=grpc:. -I=. *.proto 8 | -------------------------------------------------------------------------------- /vendor/github.com/dgraph-io/badger/protos/manifest.proto: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Dgraph Labs, Inc. and Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Use protos/gen.sh to generate .pb.go files. 18 | syntax = "proto3"; 19 | 20 | package protos; 21 | 22 | message ManifestChangeSet { 23 | // A set of changes that are applied atomically. 24 | repeated ManifestChange changes = 1; 25 | } 26 | 27 | message ManifestChange { 28 | uint64 Id = 1; 29 | enum Operation { 30 | CREATE = 0; 31 | DELETE = 1; 32 | } 33 | Operation Op = 2; 34 | uint32 Level = 3; // Only used for CREATE 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/dgraph-io/badger/table/README.md: -------------------------------------------------------------------------------- 1 | # BenchmarkRead 2 | 3 | ``` 4 | $ go test -bench Read$ -count 3 5 | 6 | Size of table: 105843444 7 | BenchmarkRead-8 3 343846914 ns/op 8 | BenchmarkRead-8 3 351790907 ns/op 9 | BenchmarkRead-8 3 351762823 ns/op 10 | ``` 11 | 12 | Size of table is 105,843,444 bytes, which is ~101M. 13 | 14 | The rate is ~287M/s which matches our read speed. This is using mmap. 15 | 16 | To read a 64M table, this would take ~0.22s, which is negligible. 17 | 18 | ``` 19 | $ go test -bench BenchmarkReadAndBuild -count 3 20 | 21 | BenchmarkReadAndBuild-8 1 2341034225 ns/op 22 | BenchmarkReadAndBuild-8 1 2346349671 ns/op 23 | BenchmarkReadAndBuild-8 1 2364064576 ns/op 24 | ``` 25 | 26 | The rate is ~43M/s. To build a ~64M table, this would take ~1.5s. Note that this 27 | does NOT include the flushing of the table to disk. All we are doing above is 28 | to read one table (mmaped) and write one table in memory. 29 | 30 | The table building takes 1.5-0.22 ~ 1.3s. 31 | 32 | If we are writing out up to 10 tables, this would take 1.5*10 ~ 15s, and ~13s 33 | is spent building the tables. 34 | 35 | When running populate, building one table in memory tends to take ~1.5s to ~2.5s 36 | on my system. Where does this overhead come from? Let's investigate the merging. 37 | 38 | Below, we merge 5 tables. The total size remains unchanged at ~101M. 39 | 40 | ``` 41 | $ go test -bench ReadMerged -count 3 42 | BenchmarkReadMerged-8 1 1321190264 ns/op 43 | BenchmarkReadMerged-8 1 1296958737 ns/op 44 | BenchmarkReadMerged-8 1 1314381178 ns/op 45 | ``` 46 | 47 | The rate is ~76M/s. To build a 64M table, this would take ~0.84s. The writing 48 | takes ~1.3s as we saw above. So in total, we expect around 0.84+1.3 ~ 2.1s. 49 | This roughly matches what we observe when running populate. There might be 50 | some additional overhead due to the concurrent writes going on, in flushing the 51 | table to disk. Also, the tables tend to be slightly bigger than 64M/s. -------------------------------------------------------------------------------- /vendor/github.com/dgraph-io/badger/test.sh: -------------------------------------------------------------------------------- 1 | l=$(go list ./...) 2 | for x in $l; do 3 | echo "Testing package $x" 4 | go test -race -v $x 5 | done 6 | -------------------------------------------------------------------------------- /vendor/github.com/dgraph-io/badger/y/error.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Dgraph Labs, Inc. and Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package y 18 | 19 | // This file contains some functions for error handling. Note that we are moving 20 | // towards using x.Trace, i.e., rpc tracing using net/tracer. But for now, these 21 | // functions are useful for simple checks logged on one machine. 22 | // Some common use cases are: 23 | // (1) You receive an error from external lib, and would like to check/log fatal. 24 | // For this, use x.Check, x.Checkf. These will check for err != nil, which is 25 | // more common in Go. If you want to check for boolean being true, use 26 | // x.Assert, x.Assertf. 27 | // (2) You receive an error from external lib, and would like to pass on with some 28 | // stack trace information. In this case, use x.Wrap or x.Wrapf. 29 | // (3) You want to generate a new error with stack trace info. Use x.Errorf. 30 | 31 | import ( 32 | "fmt" 33 | "log" 34 | 35 | "github.com/pkg/errors" 36 | ) 37 | 38 | var debugMode = true 39 | 40 | // Check logs fatal if err != nil. 41 | func Check(err error) { 42 | if err != nil { 43 | log.Fatalf("%+v", Wrap(err)) 44 | } 45 | } 46 | 47 | // Check2 acts as convenience wrapper around Check, using the 2nd argument as error. 48 | func Check2(_ interface{}, err error) { 49 | Check(err) 50 | } 51 | 52 | // AssertTrue asserts that b is true. Otherwise, it would log fatal. 53 | func AssertTrue(b bool) { 54 | if !b { 55 | log.Fatalf("%+v", errors.Errorf("Assert failed")) 56 | } 57 | } 58 | 59 | // AssertTruef is AssertTrue with extra info. 60 | func AssertTruef(b bool, format string, args ...interface{}) { 61 | if !b { 62 | log.Fatalf("%+v", errors.Errorf(format, args...)) 63 | } 64 | } 65 | 66 | // Wrap wraps errors from external lib. 67 | func Wrap(err error) error { 68 | if !debugMode { 69 | return err 70 | } 71 | return errors.Wrap(err, "") 72 | } 73 | 74 | // Wrapf is Wrap with extra info. 75 | func Wrapf(err error, format string, args ...interface{}) error { 76 | if !debugMode { 77 | if err == nil { 78 | return nil 79 | } 80 | return fmt.Errorf(format+" error: %+v", append(args, err)...) 81 | } 82 | return errors.Wrapf(err, format, args...) 83 | } 84 | -------------------------------------------------------------------------------- /vendor/github.com/dgraph-io/badger/y/file_dsync.go: -------------------------------------------------------------------------------- 1 | // +build !dragonfly,!freebsd,!windows 2 | 3 | /* 4 | * Copyright 2017 Dgraph Labs, Inc. and Contributors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package y 20 | 21 | import "golang.org/x/sys/unix" 22 | 23 | func init() { 24 | datasyncFileFlag = unix.O_DSYNC 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/dgraph-io/badger/y/file_nodsync.go: -------------------------------------------------------------------------------- 1 | // +build dragonfly freebsd windows 2 | 3 | /* 4 | * Copyright 2017 Dgraph Labs, Inc. and Contributors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package y 20 | 21 | import "syscall" 22 | 23 | func init() { 24 | datasyncFileFlag = syscall.O_SYNC 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/dgraph-io/badger/y/metrics.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Dgraph Labs, Inc. and Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package y 18 | 19 | import "expvar" 20 | 21 | var ( 22 | // LSMSize has size of the LSM in bytes 23 | LSMSize *expvar.Map 24 | // VlogSize has size of the value log in bytes 25 | VlogSize *expvar.Map 26 | // PendingWrites tracks the number of pending writes. 27 | PendingWrites *expvar.Map 28 | 29 | // These are cumulative 30 | 31 | // NumReads has cumulative number of reads 32 | NumReads *expvar.Int 33 | // NumWrites has cumulative number of writes 34 | NumWrites *expvar.Int 35 | // NumBytesRead has cumulative number of bytes read 36 | NumBytesRead *expvar.Int 37 | // NumBytesWritten has cumulative number of bytes written 38 | NumBytesWritten *expvar.Int 39 | // NumLSMGets is number of LMS gets 40 | NumLSMGets *expvar.Map 41 | // NumLSMBloomHits is number of LMS bloom hits 42 | NumLSMBloomHits *expvar.Map 43 | // NumGets is number of gets 44 | NumGets *expvar.Int 45 | // NumPuts is number of puts 46 | NumPuts *expvar.Int 47 | // NumBlockedPuts is number of blocked puts 48 | NumBlockedPuts *expvar.Int 49 | // NumMemtableGets is number of memtable gets 50 | NumMemtableGets *expvar.Int 51 | ) 52 | 53 | // These variables are global and have cumulative values for all kv stores. 54 | func init() { 55 | NumReads = expvar.NewInt("badger_disk_reads_total") 56 | NumWrites = expvar.NewInt("badger_disk_writes_total") 57 | NumBytesRead = expvar.NewInt("badger_read_bytes") 58 | NumBytesWritten = expvar.NewInt("badger_written_bytes") 59 | NumLSMGets = expvar.NewMap("badger_lsm_level_gets_total") 60 | NumLSMBloomHits = expvar.NewMap("badger_lsm_bloom_hits_total") 61 | NumGets = expvar.NewInt("badger_gets_total") 62 | NumPuts = expvar.NewInt("badger_puts_total") 63 | NumBlockedPuts = expvar.NewInt("badger_blocked_puts_total") 64 | NumMemtableGets = expvar.NewInt("badger_memtable_gets_total") 65 | LSMSize = expvar.NewMap("badger_lsm_size_bytes") 66 | VlogSize = expvar.NewMap("badger_vlog_size_bytes") 67 | PendingWrites = expvar.NewMap("badger_pending_writes_total") 68 | } 69 | -------------------------------------------------------------------------------- /vendor/github.com/dgraph-io/badger/y/mmap_unix.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | /* 4 | * Copyright 2017 Dgraph Labs, Inc. and Contributors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package y 20 | 21 | import ( 22 | "os" 23 | "syscall" 24 | "unsafe" 25 | 26 | "golang.org/x/sys/unix" 27 | ) 28 | 29 | // Mmap uses the mmap system call to memory-map a file. If writable is true, 30 | // memory protection of the pages is set so that they may be written to as well. 31 | func Mmap(fd *os.File, writable bool, size int64) ([]byte, error) { 32 | mtype := unix.PROT_READ 33 | if writable { 34 | mtype |= unix.PROT_WRITE 35 | } 36 | return unix.Mmap(int(fd.Fd()), 0, int(size), mtype, unix.MAP_SHARED) 37 | } 38 | 39 | // Munmap unmaps a previously mapped slice. 40 | func Munmap(b []byte) error { 41 | return unix.Munmap(b) 42 | } 43 | 44 | // Madvise uses the madvise system call to give advise about the use of memory 45 | // when using a slice that is memory-mapped to a file. Set the readahead flag to 46 | // false if page references are expected in random order. 47 | func Madvise(b []byte, readahead bool) error { 48 | flags := unix.MADV_NORMAL 49 | if !readahead { 50 | flags = unix.MADV_RANDOM 51 | } 52 | return madvise(b, flags) 53 | } 54 | 55 | // This is required because the unix package does not support the madvise system call on OS X. 56 | func madvise(b []byte, advice int) (err error) { 57 | _, _, e1 := syscall.Syscall(syscall.SYS_MADVISE, uintptr(unsafe.Pointer(&b[0])), 58 | uintptr(len(b)), uintptr(advice)) 59 | if e1 != 0 { 60 | err = e1 61 | } 62 | return 63 | } 64 | -------------------------------------------------------------------------------- /vendor/github.com/dgraph-io/badger/y/mmap_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | /* 4 | * Copyright 2017 Dgraph Labs, Inc. and Contributors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package y 20 | 21 | import ( 22 | "fmt" 23 | "os" 24 | "syscall" 25 | "unsafe" 26 | ) 27 | 28 | func Mmap(fd *os.File, write bool, size int64) ([]byte, error) { 29 | protect := syscall.PAGE_READONLY 30 | access := syscall.FILE_MAP_READ 31 | 32 | if write { 33 | protect = syscall.PAGE_READWRITE 34 | access = syscall.FILE_MAP_WRITE 35 | } 36 | fi, err := fd.Stat() 37 | if err != nil { 38 | return nil, err 39 | } 40 | 41 | // Truncate the database to the size of the mmap. 42 | if fi.Size() < size { 43 | if err := fd.Truncate(size); err != nil { 44 | return nil, fmt.Errorf("truncate: %s", err) 45 | } 46 | } 47 | 48 | // Open a file mapping handle. 49 | sizelo := uint32(size >> 32) 50 | sizehi := uint32(size) & 0xffffffff 51 | 52 | handler, err := syscall.CreateFileMapping(syscall.Handle(fd.Fd()), nil, 53 | uint32(protect), sizelo, sizehi, nil) 54 | if err != nil { 55 | return nil, os.NewSyscallError("CreateFileMapping", err) 56 | } 57 | 58 | // Create the memory map. 59 | addr, err := syscall.MapViewOfFile(handler, uint32(access), 0, 0, uintptr(size)) 60 | if addr == 0 { 61 | return nil, os.NewSyscallError("MapViewOfFile", err) 62 | } 63 | 64 | // Close mapping handle. 65 | if err := syscall.CloseHandle(syscall.Handle(handler)); err != nil { 66 | return nil, os.NewSyscallError("CloseHandle", err) 67 | } 68 | 69 | // Slice memory layout 70 | // Copied this snippet from golang/sys package 71 | var sl = struct { 72 | addr uintptr 73 | len int 74 | cap int 75 | }{addr, int(size), int(size)} 76 | 77 | // Use unsafe to turn sl into a []byte. 78 | data := *(*[]byte)(unsafe.Pointer(&sl)) 79 | 80 | return data, nil 81 | } 82 | 83 | func Munmap(b []byte) error { 84 | return syscall.UnmapViewOfFile(uintptr(unsafe.Pointer(&b[0]))) 85 | } 86 | 87 | func Madvise(b []byte, readahead bool) error { 88 | // Do Nothing. We don’t care about this setting on Windows 89 | return nil 90 | } 91 | -------------------------------------------------------------------------------- /vendor/github.com/dgryski/go-farm/LICENSE: -------------------------------------------------------------------------------- 1 | As this is a highly derivative work, I have placed it under the same license as the original implementation: 2 | 3 | Copyright (c) 2014-2017 Damian Gryski 4 | Copyright (c) 2016-2017 Nicola Asuni - Tecnick.com 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------------- /vendor/github.com/dgryski/go-farm/README.md: -------------------------------------------------------------------------------- 1 | # go-farm 2 | 3 | *Google's FarmHash hash functions implemented in Go* 4 | 5 | [![Master Branch](https://img.shields.io/badge/-master:-gray.svg)](https://github.com/dgryski/go-farm/tree/master) 6 | [![Master Build Status](https://secure.travis-ci.org/dgryski/go-farm.png?branch=master)](https://travis-ci.org/dgryski/go-farm?branch=master) 7 | [![Master Coverage Status](https://coveralls.io/repos/dgryski/go-farm/badge.svg?branch=master&service=github)](https://coveralls.io/github/dgryski/go-farm?branch=master) 8 | [![Go Report Card](https://goreportcard.com/badge/github.com/dgryski/go-farm)](https://goreportcard.com/report/github.com/dgryski/go-farm) 9 | [![GoDoc](https://godoc.org/github.com/dgryski/go-farm?status.svg)](http://godoc.org/github.com/dgryski/go-farm) 10 | 11 | ## Description 12 | 13 | FarmHash, a family of hash functions. 14 | 15 | This is a (mechanical) translation of the non-SSE4/non-AESNI hash functions from Google's FarmHash (https://github.com/google/farmhash). 16 | 17 | 18 | FarmHash provides hash functions for strings and other data. 19 | The functions mix the input bits thoroughly but are not suitable for cryptography. 20 | 21 | All members of the FarmHash family were designed with heavy reliance on previous work by Jyrki Alakuijala, Austin Appleby, Bob Jenkins, and others. 22 | 23 | For more information please consult https://github.com/google/farmhash 24 | 25 | 26 | ## Getting started 27 | 28 | This application is written in Go language, please refer to the guides in https://golang.org for getting started. 29 | 30 | This project include a Makefile that allows you to test and build the project with simple commands. 31 | To see all available options: 32 | ```bash 33 | make help 34 | ``` 35 | 36 | ## Running all tests 37 | 38 | Before committing the code, please check if it passes all tests using 39 | ```bash 40 | make qa 41 | ``` 42 | -------------------------------------------------------------------------------- /vendor/github.com/dgryski/go-farm/VERSION: -------------------------------------------------------------------------------- 1 | 2.0.1 2 | -------------------------------------------------------------------------------- /vendor/github.com/dgryski/go-farm/basics.go: -------------------------------------------------------------------------------- 1 | package farm 2 | 3 | // Some primes between 2^63 and 2^64 for various uses. 4 | const k0 uint64 = 0xc3a5c85c97cb3127 5 | const k1 uint64 = 0xb492b66fbe98f273 6 | const k2 uint64 = 0x9ae16a3b2f90404f 7 | 8 | // Magic numbers for 32-bit hashing. Copied from Murmur3. 9 | const c1 uint32 = 0xcc9e2d51 10 | const c2 uint32 = 0x1b873593 11 | 12 | // A 32-bit to 32-bit integer hash copied from Murmur3. 13 | func fmix(h uint32) uint32 { 14 | h ^= h >> 16 15 | h *= 0x85ebca6b 16 | h ^= h >> 13 17 | h *= 0xc2b2ae35 18 | h ^= h >> 16 19 | return h 20 | } 21 | 22 | func mur(a, h uint32) uint32 { 23 | // Helper from Murmur3 for combining two 32-bit values. 24 | a *= c1 25 | a = rotate32(a, 17) 26 | a *= c2 27 | h ^= a 28 | h = rotate32(h, 19) 29 | return h*5 + 0xe6546b64 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/dgryski/go-farm/farmhashmk.go: -------------------------------------------------------------------------------- 1 | package farm 2 | 3 | func hash32Len5to12(s []byte, seed uint32) uint32 { 4 | slen := len(s) 5 | a := uint32(len(s)) 6 | b := uint32(len(s) * 5) 7 | c := uint32(9) 8 | d := b + seed 9 | a += fetch32(s, 0) 10 | b += fetch32(s, slen-4) 11 | c += fetch32(s, ((slen >> 1) & 4)) 12 | return fmix(seed ^ mur(c, mur(b, mur(a, d)))) 13 | } 14 | 15 | // Hash32 hashes a byte slice and returns a uint32 hash value 16 | func Hash32(s []byte) uint32 { 17 | 18 | slen := len(s) 19 | 20 | if slen <= 24 { 21 | if slen <= 12 { 22 | if slen <= 4 { 23 | return hash32Len0to4(s, 0) 24 | } 25 | return hash32Len5to12(s, 0) 26 | } 27 | return hash32Len13to24Seed(s, 0) 28 | } 29 | 30 | // len > 24 31 | h := uint32(slen) 32 | g := c1 * uint32(slen) 33 | f := g 34 | a0 := rotate32(fetch32(s, slen-4)*c1, 17) * c2 35 | a1 := rotate32(fetch32(s, slen-8)*c1, 17) * c2 36 | a2 := rotate32(fetch32(s, slen-16)*c1, 17) * c2 37 | a3 := rotate32(fetch32(s, slen-12)*c1, 17) * c2 38 | a4 := rotate32(fetch32(s, slen-20)*c1, 17) * c2 39 | h ^= a0 40 | h = rotate32(h, 19) 41 | h = h*5 + 0xe6546b64 42 | h ^= a2 43 | h = rotate32(h, 19) 44 | h = h*5 + 0xe6546b64 45 | g ^= a1 46 | g = rotate32(g, 19) 47 | g = g*5 + 0xe6546b64 48 | g ^= a3 49 | g = rotate32(g, 19) 50 | g = g*5 + 0xe6546b64 51 | f += a4 52 | f = rotate32(f, 19) + 113 53 | iters := (slen - 1) / 20 54 | for { 55 | a := fetch32(s, 0) 56 | b := fetch32(s, 4) 57 | c := fetch32(s, 8) 58 | d := fetch32(s, 12) 59 | e := fetch32(s, 16) 60 | h += a 61 | g += b 62 | f += c 63 | h = mur(d, h) + e 64 | g = mur(c, g) + a 65 | f = mur(b+e*c1, f) + d 66 | f += g 67 | g += f 68 | s = s[20:] 69 | iters-- 70 | if iters == 0 { 71 | break 72 | } 73 | } 74 | g = rotate32(g, 11) * c1 75 | g = rotate32(g, 17) * c1 76 | f = rotate32(f, 11) * c1 77 | f = rotate32(f, 17) * c1 78 | h = rotate32(h+g, 19) 79 | h = h*5 + 0xe6546b64 80 | h = rotate32(h, 17) * c1 81 | h = rotate32(h+f, 19) 82 | h = h*5 + 0xe6546b64 83 | h = rotate32(h, 17) * c1 84 | return h 85 | } 86 | 87 | // Hash32WithSeed hashes a byte slice and a uint32 seed and returns a uint32 hash value 88 | func Hash32WithSeed(s []byte, seed uint32) uint32 { 89 | slen := len(s) 90 | 91 | if slen <= 24 { 92 | if slen >= 13 { 93 | return hash32Len13to24Seed(s, seed*c1) 94 | } 95 | if slen >= 5 { 96 | return hash32Len5to12(s, seed) 97 | } 98 | return hash32Len0to4(s, seed) 99 | } 100 | h := hash32Len13to24Seed(s[:24], seed^uint32(slen)) 101 | return mur(Hash32(s[24:])+seed, h) 102 | } 103 | -------------------------------------------------------------------------------- /vendor/github.com/dgryski/go-farm/farmhashuo.go: -------------------------------------------------------------------------------- 1 | package farm 2 | 3 | func uoH(x, y, mul uint64, r uint) uint64 { 4 | a := (x ^ y) * mul 5 | a ^= (a >> 47) 6 | b := (y ^ a) * mul 7 | return rotate64(b, r) * mul 8 | } 9 | 10 | // Hash64WithSeeds hashes a byte slice and two uint64 seeds and returns a uint64 hash value 11 | func Hash64WithSeeds(s []byte, seed0, seed1 uint64) uint64 { 12 | slen := len(s) 13 | if slen <= 64 { 14 | return naHash64WithSeeds(s, seed0, seed1) 15 | } 16 | 17 | // For strings over 64 bytes we loop. 18 | // Internal state consists of 64 bytes: u, v, w, x, y, and z. 19 | x := seed0 20 | y := seed1*k2 + 113 21 | z := shiftMix(y*k2) * k2 22 | v := uint128{seed0, seed1} 23 | var w uint128 24 | u := x - z 25 | x *= k2 26 | mul := k2 + (u & 0x82) 27 | 28 | // Set end so that after the loop we have 1 to 64 bytes left to process. 29 | endIdx := ((slen - 1) / 64) * 64 30 | last64Idx := endIdx + ((slen - 1) & 63) - 63 31 | last64 := s[last64Idx:] 32 | 33 | for len(s) > 64 { 34 | a0 := fetch64(s, 0) 35 | a1 := fetch64(s, 8) 36 | a2 := fetch64(s, 16) 37 | a3 := fetch64(s, 24) 38 | a4 := fetch64(s, 32) 39 | a5 := fetch64(s, 40) 40 | a6 := fetch64(s, 48) 41 | a7 := fetch64(s, 56) 42 | x += a0 + a1 43 | y += a2 44 | z += a3 45 | v.lo += a4 46 | v.hi += a5 + a1 47 | w.lo += a6 48 | w.hi += a7 49 | 50 | x = rotate64(x, 26) 51 | x *= 9 52 | y = rotate64(y, 29) 53 | z *= mul 54 | v.lo = rotate64(v.lo, 33) 55 | v.hi = rotate64(v.hi, 30) 56 | w.lo ^= x 57 | w.lo *= 9 58 | z = rotate64(z, 32) 59 | z += w.hi 60 | w.hi += z 61 | z *= 9 62 | u, y = y, u 63 | 64 | z += a0 + a6 65 | v.lo += a2 66 | v.hi += a3 67 | w.lo += a4 68 | w.hi += a5 + a6 69 | x += a1 70 | y += a7 71 | 72 | y += v.lo 73 | v.lo += x - y 74 | v.hi += w.lo 75 | w.lo += v.hi 76 | w.hi += x - y 77 | x += w.hi 78 | w.hi = rotate64(w.hi, 34) 79 | u, z = z, u 80 | s = s[64:] 81 | } 82 | // Make s point to the last 64 bytes of input. 83 | s = last64 84 | u *= 9 85 | v.hi = rotate64(v.hi, 28) 86 | v.lo = rotate64(v.lo, 20) 87 | w.lo += (uint64(slen-1) & 63) 88 | u += y 89 | y += u 90 | x = rotate64(y-x+v.lo+fetch64(s, 8), 37) * mul 91 | y = rotate64(y^v.hi^fetch64(s, 48), 42) * mul 92 | x ^= w.hi * 9 93 | y += v.lo + fetch64(s, 40) 94 | z = rotate64(z+w.lo, 33) * mul 95 | v.lo, v.hi = weakHashLen32WithSeeds(s, v.hi*mul, x+w.lo) 96 | w.lo, w.hi = weakHashLen32WithSeeds(s[32:], z+w.hi, y+fetch64(s, 16)) 97 | return uoH(hashLen16Mul(v.lo+x, w.lo^y, mul)+z-u, 98 | uoH(v.hi+y, w.hi+z, k2, 30)^x, 99 | k2, 100 | 31) 101 | } 102 | 103 | // Hash64WithSeed hashes a byte slice and a uint64 seed and returns a uint64 hash value 104 | func Hash64WithSeed(s []byte, seed uint64) uint64 { 105 | if len(s) <= 64 { 106 | return naHash64WithSeed(s, seed) 107 | } 108 | return Hash64WithSeeds(s, 0, seed) 109 | } 110 | 111 | // Hash64 hashes a byte slice and returns a uint64 hash value 112 | func Hash64(s []byte) uint64 { 113 | if len(s) <= 64 { 114 | return naHash64(s) 115 | } 116 | return Hash64WithSeeds(s, 81, 0) 117 | } 118 | -------------------------------------------------------------------------------- /vendor/github.com/dgryski/go-farm/platform.go: -------------------------------------------------------------------------------- 1 | package farm 2 | 3 | func rotate32(val uint32, shift uint) uint32 { 4 | return ((val >> shift) | (val << (32 - shift))) 5 | } 6 | 7 | func rotate64(val uint64, shift uint) uint64 { 8 | return ((val >> shift) | (val << (64 - shift))) 9 | } 10 | 11 | func fetch32(s []byte, idx int) uint32 { 12 | return uint32(s[idx+0]) | uint32(s[idx+1])<<8 | uint32(s[idx+2])<<16 | uint32(s[idx+3])<<24 13 | } 14 | 15 | func fetch64(s []byte, idx int) uint64 { 16 | return uint64(s[idx+0]) | uint64(s[idx+1])<<8 | uint64(s[idx+2])<<16 | uint64(s[idx+3])<<24 | 17 | uint64(s[idx+4])<<32 | uint64(s[idx+5])<<40 | uint64(s[idx+6])<<48 | uint64(s[idx+7])<<56 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/LICENSE: -------------------------------------------------------------------------------- 1 | Go support for Protocol Buffers - Google's data interchange format 2 | 3 | Copyright 2010 The Go Authors. All rights reserved. 4 | https://github.com/golang/protobuf 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are 8 | met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above 13 | copyright notice, this list of conditions and the following disclaimer 14 | in the documentation and/or other materials provided with the 15 | distribution. 16 | * Neither the name of Google Inc. nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/proto/Makefile: -------------------------------------------------------------------------------- 1 | # Go support for Protocol Buffers - Google's data interchange format 2 | # 3 | # Copyright 2010 The Go Authors. All rights reserved. 4 | # https://github.com/golang/protobuf 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | install: 33 | go install 34 | 35 | test: install generate-test-pbs 36 | go test 37 | 38 | 39 | generate-test-pbs: 40 | make install 41 | make -C testdata 42 | protoc --go_out=Mtestdata/test.proto=github.com/golang/protobuf/proto/testdata,Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any:. proto3_proto/proto3.proto 43 | make 44 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-immutable-radix/README.md: -------------------------------------------------------------------------------- 1 | go-immutable-radix [![Build Status](https://travis-ci.org/hashicorp/go-immutable-radix.png)](https://travis-ci.org/hashicorp/go-immutable-radix) 2 | ========= 3 | 4 | Provides the `iradix` package that implements an immutable [radix tree](http://en.wikipedia.org/wiki/Radix_tree). 5 | The package only provides a single `Tree` implementation, optimized for sparse nodes. 6 | 7 | As a radix tree, it provides the following: 8 | * O(k) operations. In many cases, this can be faster than a hash table since 9 | the hash function is an O(k) operation, and hash tables have very poor cache locality. 10 | * Minimum / Maximum value lookups 11 | * Ordered iteration 12 | 13 | A tree supports using a transaction to batch multiple updates (insert, delete) 14 | in a more efficient manner than performing each operation one at a time. 15 | 16 | For a mutable variant, see [go-radix](https://github.com/armon/go-radix). 17 | 18 | Documentation 19 | ============= 20 | 21 | The full documentation is available on [Godoc](http://godoc.org/github.com/hashicorp/go-immutable-radix). 22 | 23 | Example 24 | ======= 25 | 26 | Below is a simple example of usage 27 | 28 | ```go 29 | // Create a tree 30 | r := iradix.New() 31 | r, _, _ = r.Insert([]byte("foo"), 1) 32 | r, _, _ = r.Insert([]byte("bar"), 2) 33 | r, _, _ = r.Insert([]byte("foobar"), 2) 34 | 35 | // Find the longest prefix match 36 | m, _, _ := r.Root().LongestPrefix([]byte("foozip")) 37 | if string(m) != "foo" { 38 | panic("should be foo") 39 | } 40 | ``` 41 | 42 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-immutable-radix/edges.go: -------------------------------------------------------------------------------- 1 | package iradix 2 | 3 | import "sort" 4 | 5 | type edges []edge 6 | 7 | func (e edges) Len() int { 8 | return len(e) 9 | } 10 | 11 | func (e edges) Less(i, j int) bool { 12 | return e[i].label < e[j].label 13 | } 14 | 15 | func (e edges) Swap(i, j int) { 16 | e[i], e[j] = e[j], e[i] 17 | } 18 | 19 | func (e edges) Sort() { 20 | sort.Sort(e) 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-immutable-radix/iter.go: -------------------------------------------------------------------------------- 1 | package iradix 2 | 3 | import "bytes" 4 | 5 | // Iterator is used to iterate over a set of nodes 6 | // in pre-order 7 | type Iterator struct { 8 | node *Node 9 | stack []edges 10 | } 11 | 12 | // SeekPrefixWatch is used to seek the iterator to a given prefix 13 | // and returns the watch channel of the finest granularity 14 | func (i *Iterator) SeekPrefixWatch(prefix []byte) (watch <-chan struct{}) { 15 | // Wipe the stack 16 | i.stack = nil 17 | n := i.node 18 | watch = n.mutateCh 19 | search := prefix 20 | for { 21 | // Check for key exhaution 22 | if len(search) == 0 { 23 | i.node = n 24 | return 25 | } 26 | 27 | // Look for an edge 28 | _, n = n.getEdge(search[0]) 29 | if n == nil { 30 | i.node = nil 31 | return 32 | } 33 | 34 | // Update to the finest granularity as the search makes progress 35 | watch = n.mutateCh 36 | 37 | // Consume the search prefix 38 | if bytes.HasPrefix(search, n.prefix) { 39 | search = search[len(n.prefix):] 40 | 41 | } else if bytes.HasPrefix(n.prefix, search) { 42 | i.node = n 43 | return 44 | } else { 45 | i.node = nil 46 | return 47 | } 48 | } 49 | } 50 | 51 | // SeekPrefix is used to seek the iterator to a given prefix 52 | func (i *Iterator) SeekPrefix(prefix []byte) { 53 | i.SeekPrefixWatch(prefix) 54 | } 55 | 56 | // Next returns the next node in order 57 | func (i *Iterator) Next() ([]byte, interface{}, bool) { 58 | // Initialize our stack if needed 59 | if i.stack == nil && i.node != nil { 60 | i.stack = []edges{ 61 | edges{ 62 | edge{node: i.node}, 63 | }, 64 | } 65 | } 66 | 67 | for len(i.stack) > 0 { 68 | // Inspect the last element of the stack 69 | n := len(i.stack) 70 | last := i.stack[n-1] 71 | elem := last[0].node 72 | 73 | // Update the stack 74 | if len(last) > 1 { 75 | i.stack[n-1] = last[1:] 76 | } else { 77 | i.stack = i.stack[:n-1] 78 | } 79 | 80 | // Push the edges onto the frontier 81 | if len(elem.edges) > 0 { 82 | i.stack = append(i.stack, elem.edges) 83 | } 84 | 85 | // Return the leaf values if any 86 | if elem.leaf != nil { 87 | return elem.leaf.key, elem.leaf.val, true 88 | } 89 | } 90 | return nil, nil, false 91 | } 92 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-immutable-radix/raw_iter.go: -------------------------------------------------------------------------------- 1 | package iradix 2 | 3 | // rawIterator visits each of the nodes in the tree, even the ones that are not 4 | // leaves. It keeps track of the effective path (what a leaf at a given node 5 | // would be called), which is useful for comparing trees. 6 | type rawIterator struct { 7 | // node is the starting node in the tree for the iterator. 8 | node *Node 9 | 10 | // stack keeps track of edges in the frontier. 11 | stack []rawStackEntry 12 | 13 | // pos is the current position of the iterator. 14 | pos *Node 15 | 16 | // path is the effective path of the current iterator position, 17 | // regardless of whether the current node is a leaf. 18 | path string 19 | } 20 | 21 | // rawStackEntry is used to keep track of the cumulative common path as well as 22 | // its associated edges in the frontier. 23 | type rawStackEntry struct { 24 | path string 25 | edges edges 26 | } 27 | 28 | // Front returns the current node that has been iterated to. 29 | func (i *rawIterator) Front() *Node { 30 | return i.pos 31 | } 32 | 33 | // Path returns the effective path of the current node, even if it's not actually 34 | // a leaf. 35 | func (i *rawIterator) Path() string { 36 | return i.path 37 | } 38 | 39 | // Next advances the iterator to the next node. 40 | func (i *rawIterator) Next() { 41 | // Initialize our stack if needed. 42 | if i.stack == nil && i.node != nil { 43 | i.stack = []rawStackEntry{ 44 | rawStackEntry{ 45 | edges: edges{ 46 | edge{node: i.node}, 47 | }, 48 | }, 49 | } 50 | } 51 | 52 | for len(i.stack) > 0 { 53 | // Inspect the last element of the stack. 54 | n := len(i.stack) 55 | last := i.stack[n-1] 56 | elem := last.edges[0].node 57 | 58 | // Update the stack. 59 | if len(last.edges) > 1 { 60 | i.stack[n-1].edges = last.edges[1:] 61 | } else { 62 | i.stack = i.stack[:n-1] 63 | } 64 | 65 | // Push the edges onto the frontier. 66 | if len(elem.edges) > 0 { 67 | path := last.path + string(elem.prefix) 68 | i.stack = append(i.stack, rawStackEntry{path, elem.edges}) 69 | } 70 | 71 | i.pos = elem 72 | i.path = last.path + string(elem.prefix) 73 | return 74 | } 75 | 76 | i.pos = nil 77 | i.path = "" 78 | } 79 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-msgpack/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, 2013 Ugorji Nwoke. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | * Neither the name of the author nor the names of its contributors may be used 13 | to endorse or promote products derived from this software 14 | without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go: -------------------------------------------------------------------------------- 1 | package simplelru 2 | 3 | 4 | // LRUCache is the interface for simple LRU cache. 5 | type LRUCache interface { 6 | // Adds a value to the cache, returns true if an eviction occurred and 7 | // updates the "recently used"-ness of the key. 8 | Add(key, value interface{}) bool 9 | 10 | // Returns key's value from the cache and 11 | // updates the "recently used"-ness of the key. #value, isFound 12 | Get(key interface{}) (value interface{}, ok bool) 13 | 14 | // Check if a key exsists in cache without updating the recent-ness. 15 | Contains(key interface{}) (ok bool) 16 | 17 | // Returns key's value without updating the "recently used"-ness of the key. 18 | Peek(key interface{}) (value interface{}, ok bool) 19 | 20 | // Removes a key from the cache. 21 | Remove(key interface{}) bool 22 | 23 | // Removes the oldest entry from cache. 24 | RemoveOldest() (interface{}, interface{}, bool) 25 | 26 | // Returns the oldest entry from the cache. #key, value, isFound 27 | GetOldest() (interface{}, interface{}, bool) 28 | 29 | // Returns a slice of the keys in the cache, from oldest to newest. 30 | Keys() []interface{} 31 | 32 | // Returns the number of items in the cache. 33 | Len() int 34 | 35 | // Clear all cache entries 36 | Purge() 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/raft-boltdb/Makefile: -------------------------------------------------------------------------------- 1 | DEPS = $(go list -f '{{range .TestImports}}{{.}} {{end}}' ./...) 2 | 3 | .PHONY: test deps 4 | 5 | test: 6 | go test -timeout=30s ./... 7 | 8 | deps: 9 | go get -d -v ./... 10 | echo $(DEPS) | xargs -n1 go get -d 11 | 12 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/raft-boltdb/README.md: -------------------------------------------------------------------------------- 1 | raft-boltdb 2 | =========== 3 | 4 | This repository provides the `raftboltdb` package. The package exports the 5 | `BoltStore` which is an implementation of both a `LogStore` and `StableStore`. 6 | 7 | It is meant to be used as a backend for the `raft` [package 8 | here](https://github.com/hashicorp/raft). 9 | 10 | This implementation uses [BoltDB](https://github.com/boltdb/bolt). BoltDB is 11 | a simple key/value store implemented in pure Go, and inspired by LMDB. 12 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/raft-boltdb/util.go: -------------------------------------------------------------------------------- 1 | package raftboltdb 2 | 3 | import ( 4 | "bytes" 5 | "encoding/binary" 6 | 7 | "github.com/hashicorp/go-msgpack/codec" 8 | ) 9 | 10 | // Decode reverses the encode operation on a byte slice input 11 | func decodeMsgPack(buf []byte, out interface{}) error { 12 | r := bytes.NewBuffer(buf) 13 | hd := codec.MsgpackHandle{} 14 | dec := codec.NewDecoder(r, &hd) 15 | return dec.Decode(out) 16 | } 17 | 18 | // Encode writes an encoded object to a new bytes buffer 19 | func encodeMsgPack(in interface{}) (*bytes.Buffer, error) { 20 | buf := bytes.NewBuffer(nil) 21 | hd := codec.MsgpackHandle{} 22 | enc := codec.NewEncoder(buf, &hd) 23 | err := enc.Encode(in) 24 | return buf, err 25 | } 26 | 27 | // Converts bytes to an integer 28 | func bytesToUint64(b []byte) uint64 { 29 | return binary.BigEndian.Uint64(b) 30 | } 31 | 32 | // Converts a uint to a byte slice 33 | func uint64ToBytes(u uint64) []byte { 34 | buf := make([]byte, 8) 35 | binary.BigEndian.PutUint64(buf, u) 36 | return buf 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/raft/Makefile: -------------------------------------------------------------------------------- 1 | DEPS = $(go list -f '{{range .TestImports}}{{.}} {{end}}' ./...) 2 | 3 | test: 4 | go test -timeout=60s . 5 | 6 | integ: test 7 | INTEG_TESTS=yes go test -timeout=25s -run=Integ . 8 | 9 | fuzz: 10 | go test -timeout=300s ./fuzzy 11 | 12 | deps: 13 | go get -d -v ./... 14 | echo $(DEPS) | xargs -n1 go get -d 15 | 16 | cov: 17 | INTEG_TESTS=yes gocov test github.com/hashicorp/raft | gocov-html > /tmp/coverage.html 18 | open /tmp/coverage.html 19 | 20 | .PHONY: test cov integ deps 21 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/raft/discard_snapshot.go: -------------------------------------------------------------------------------- 1 | package raft 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | ) 7 | 8 | // DiscardSnapshotStore is used to successfully snapshot while 9 | // always discarding the snapshot. This is useful for when the 10 | // log should be truncated but no snapshot should be retained. 11 | // This should never be used for production use, and is only 12 | // suitable for testing. 13 | type DiscardSnapshotStore struct{} 14 | 15 | type DiscardSnapshotSink struct{} 16 | 17 | // NewDiscardSnapshotStore is used to create a new DiscardSnapshotStore. 18 | func NewDiscardSnapshotStore() *DiscardSnapshotStore { 19 | return &DiscardSnapshotStore{} 20 | } 21 | 22 | func (d *DiscardSnapshotStore) Create(version SnapshotVersion, index, term uint64, 23 | configuration Configuration, configurationIndex uint64, trans Transport) (SnapshotSink, error) { 24 | return &DiscardSnapshotSink{}, nil 25 | } 26 | 27 | func (d *DiscardSnapshotStore) List() ([]*SnapshotMeta, error) { 28 | return nil, nil 29 | } 30 | 31 | func (d *DiscardSnapshotStore) Open(id string) (*SnapshotMeta, io.ReadCloser, error) { 32 | return nil, nil, fmt.Errorf("open is not supported") 33 | } 34 | 35 | func (d *DiscardSnapshotSink) Write(b []byte) (int, error) { 36 | return len(b), nil 37 | } 38 | 39 | func (d *DiscardSnapshotSink) Close() error { 40 | return nil 41 | } 42 | 43 | func (d *DiscardSnapshotSink) ID() string { 44 | return "discard" 45 | } 46 | 47 | func (d *DiscardSnapshotSink) Cancel() error { 48 | return nil 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/raft/inmem_snapshot.go: -------------------------------------------------------------------------------- 1 | package raft 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "io" 7 | "io/ioutil" 8 | "sync" 9 | ) 10 | 11 | // InmemSnapshotStore implements the SnapshotStore interface and 12 | // retains only the most recent snapshot 13 | type InmemSnapshotStore struct { 14 | latest *InmemSnapshotSink 15 | hasSnapshot bool 16 | sync.RWMutex 17 | } 18 | 19 | // InmemSnapshotSink implements SnapshotSink in memory 20 | type InmemSnapshotSink struct { 21 | meta SnapshotMeta 22 | contents *bytes.Buffer 23 | } 24 | 25 | // NewInmemSnapshotStore creates a blank new InmemSnapshotStore 26 | func NewInmemSnapshotStore() *InmemSnapshotStore { 27 | return &InmemSnapshotStore{ 28 | latest: &InmemSnapshotSink{ 29 | contents: &bytes.Buffer{}, 30 | }, 31 | } 32 | } 33 | 34 | // Create replaces the stored snapshot with a new one using the given args 35 | func (m *InmemSnapshotStore) Create(version SnapshotVersion, index, term uint64, 36 | configuration Configuration, configurationIndex uint64, trans Transport) (SnapshotSink, error) { 37 | // We only support version 1 snapshots at this time. 38 | if version != 1 { 39 | return nil, fmt.Errorf("unsupported snapshot version %d", version) 40 | } 41 | 42 | name := snapshotName(term, index) 43 | 44 | m.Lock() 45 | defer m.Unlock() 46 | 47 | sink := &InmemSnapshotSink{ 48 | meta: SnapshotMeta{ 49 | Version: version, 50 | ID: name, 51 | Index: index, 52 | Term: term, 53 | Peers: encodePeers(configuration, trans), 54 | Configuration: configuration, 55 | ConfigurationIndex: configurationIndex, 56 | }, 57 | contents: &bytes.Buffer{}, 58 | } 59 | m.hasSnapshot = true 60 | m.latest = sink 61 | 62 | return sink, nil 63 | } 64 | 65 | // List returns the latest snapshot taken 66 | func (m *InmemSnapshotStore) List() ([]*SnapshotMeta, error) { 67 | m.RLock() 68 | defer m.RUnlock() 69 | 70 | if !m.hasSnapshot { 71 | return []*SnapshotMeta{}, nil 72 | } 73 | return []*SnapshotMeta{&m.latest.meta}, nil 74 | } 75 | 76 | // Open wraps an io.ReadCloser around the snapshot contents 77 | func (m *InmemSnapshotStore) Open(id string) (*SnapshotMeta, io.ReadCloser, error) { 78 | m.RLock() 79 | defer m.RUnlock() 80 | 81 | if m.latest.meta.ID != id { 82 | return nil, nil, fmt.Errorf("[ERR] snapshot: failed to open snapshot id: %s", id) 83 | } 84 | 85 | return &m.latest.meta, ioutil.NopCloser(m.latest.contents), nil 86 | } 87 | 88 | // Write appends the given bytes to the snapshot contents 89 | func (s *InmemSnapshotSink) Write(p []byte) (n int, err error) { 90 | written, err := io.Copy(s.contents, bytes.NewReader(p)) 91 | s.meta.Size += written 92 | return int(written), err 93 | } 94 | 95 | // Close updates the Size and is otherwise a no-op 96 | func (s *InmemSnapshotSink) Close() error { 97 | return nil 98 | } 99 | 100 | func (s *InmemSnapshotSink) ID() string { 101 | return s.meta.ID 102 | } 103 | 104 | func (s *InmemSnapshotSink) Cancel() error { 105 | return nil 106 | } 107 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/raft/log.go: -------------------------------------------------------------------------------- 1 | package raft 2 | 3 | // LogType describes various types of log entries. 4 | type LogType uint8 5 | 6 | const ( 7 | // LogCommand is applied to a user FSM. 8 | LogCommand LogType = iota 9 | 10 | // LogNoop is used to assert leadership. 11 | LogNoop 12 | 13 | // LogAddPeer is used to add a new peer. This should only be used with 14 | // older protocol versions designed to be compatible with unversioned 15 | // Raft servers. See comments in config.go for details. 16 | LogAddPeerDeprecated 17 | 18 | // LogRemovePeer is used to remove an existing peer. This should only be 19 | // used with older protocol versions designed to be compatible with 20 | // unversioned Raft servers. See comments in config.go for details. 21 | LogRemovePeerDeprecated 22 | 23 | // LogBarrier is used to ensure all preceding operations have been 24 | // applied to the FSM. It is similar to LogNoop, but instead of returning 25 | // once committed, it only returns once the FSM manager acks it. Otherwise 26 | // it is possible there are operations committed but not yet applied to 27 | // the FSM. 28 | LogBarrier 29 | 30 | // LogConfiguration establishes a membership change configuration. It is 31 | // created when a server is added, removed, promoted, etc. Only used 32 | // when protocol version 1 or greater is in use. 33 | LogConfiguration 34 | ) 35 | 36 | // Log entries are replicated to all members of the Raft cluster 37 | // and form the heart of the replicated state machine. 38 | type Log struct { 39 | // Index holds the index of the log entry. 40 | Index uint64 41 | 42 | // Term holds the election term of the log entry. 43 | Term uint64 44 | 45 | // Type holds the type of the log entry. 46 | Type LogType 47 | 48 | // Data holds the log entry's type-specific data. 49 | Data []byte 50 | } 51 | 52 | // LogStore is used to provide an interface for storing 53 | // and retrieving logs in a durable fashion. 54 | type LogStore interface { 55 | // FirstIndex returns the first index written. 0 for no entries. 56 | FirstIndex() (uint64, error) 57 | 58 | // LastIndex returns the last index written. 0 for no entries. 59 | LastIndex() (uint64, error) 60 | 61 | // GetLog gets a log entry at a given index. 62 | GetLog(index uint64, log *Log) error 63 | 64 | // StoreLog stores a log entry. 65 | StoreLog(log *Log) error 66 | 67 | // StoreLogs stores multiple log entries. 68 | StoreLogs(logs []*Log) error 69 | 70 | // DeleteRange deletes a range of log entries. The range is inclusive. 71 | DeleteRange(min, max uint64) error 72 | } 73 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/raft/log_cache.go: -------------------------------------------------------------------------------- 1 | package raft 2 | 3 | import ( 4 | "fmt" 5 | "sync" 6 | ) 7 | 8 | // LogCache wraps any LogStore implementation to provide an 9 | // in-memory ring buffer. This is used to cache access to 10 | // the recently written entries. For implementations that do not 11 | // cache themselves, this can provide a substantial boost by 12 | // avoiding disk I/O on recent entries. 13 | type LogCache struct { 14 | store LogStore 15 | 16 | cache []*Log 17 | l sync.RWMutex 18 | } 19 | 20 | // NewLogCache is used to create a new LogCache with the 21 | // given capacity and backend store. 22 | func NewLogCache(capacity int, store LogStore) (*LogCache, error) { 23 | if capacity <= 0 { 24 | return nil, fmt.Errorf("capacity must be positive") 25 | } 26 | c := &LogCache{ 27 | store: store, 28 | cache: make([]*Log, capacity), 29 | } 30 | return c, nil 31 | } 32 | 33 | func (c *LogCache) GetLog(idx uint64, log *Log) error { 34 | // Check the buffer for an entry 35 | c.l.RLock() 36 | cached := c.cache[idx%uint64(len(c.cache))] 37 | c.l.RUnlock() 38 | 39 | // Check if entry is valid 40 | if cached != nil && cached.Index == idx { 41 | *log = *cached 42 | return nil 43 | } 44 | 45 | // Forward request on cache miss 46 | return c.store.GetLog(idx, log) 47 | } 48 | 49 | func (c *LogCache) StoreLog(log *Log) error { 50 | return c.StoreLogs([]*Log{log}) 51 | } 52 | 53 | func (c *LogCache) StoreLogs(logs []*Log) error { 54 | // Insert the logs into the ring buffer 55 | c.l.Lock() 56 | for _, l := range logs { 57 | c.cache[l.Index%uint64(len(c.cache))] = l 58 | } 59 | c.l.Unlock() 60 | 61 | return c.store.StoreLogs(logs) 62 | } 63 | 64 | func (c *LogCache) FirstIndex() (uint64, error) { 65 | return c.store.FirstIndex() 66 | } 67 | 68 | func (c *LogCache) LastIndex() (uint64, error) { 69 | return c.store.LastIndex() 70 | } 71 | 72 | func (c *LogCache) DeleteRange(min, max uint64) error { 73 | // Invalidate the cache on deletes 74 | c.l.Lock() 75 | c.cache = make([]*Log, len(c.cache)) 76 | c.l.Unlock() 77 | 78 | return c.store.DeleteRange(min, max) 79 | } 80 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/raft/peersjson.go: -------------------------------------------------------------------------------- 1 | package raft 2 | 3 | import ( 4 | "bytes" 5 | "encoding/json" 6 | "io/ioutil" 7 | ) 8 | 9 | // ReadPeersJSON consumes a legacy peers.json file in the format of the old JSON 10 | // peer store and creates a new-style configuration structure. This can be used 11 | // to migrate this data or perform manual recovery when running protocol versions 12 | // that can interoperate with older, unversioned Raft servers. This should not be 13 | // used once server IDs are in use, because the old peers.json file didn't have 14 | // support for these, nor non-voter suffrage types. 15 | func ReadPeersJSON(path string) (Configuration, error) { 16 | // Read in the file. 17 | buf, err := ioutil.ReadFile(path) 18 | if err != nil { 19 | return Configuration{}, err 20 | } 21 | 22 | // Parse it as JSON. 23 | var peers []string 24 | dec := json.NewDecoder(bytes.NewReader(buf)) 25 | if err := dec.Decode(&peers); err != nil { 26 | return Configuration{}, err 27 | } 28 | 29 | // Map it into the new-style configuration structure. We can only specify 30 | // voter roles here, and the ID has to be the same as the address. 31 | var configuration Configuration 32 | for _, peer := range peers { 33 | server := Server{ 34 | Suffrage: Voter, 35 | ID: ServerID(peer), 36 | Address: ServerAddress(peer), 37 | } 38 | configuration.Servers = append(configuration.Servers, server) 39 | } 40 | 41 | // We should only ingest valid configurations. 42 | if err := checkConfiguration(configuration); err != nil { 43 | return Configuration{}, err 44 | } 45 | return configuration, nil 46 | } 47 | 48 | // configEntry is used when decoding a new-style peers.json. 49 | type configEntry struct { 50 | // ID is the ID of the server (a UUID, usually). 51 | ID ServerID `json:"id"` 52 | 53 | // Address is the host:port of the server. 54 | Address ServerAddress `json:"address"` 55 | 56 | // NonVoter controls the suffrage. We choose this sense so people 57 | // can leave this out and get a Voter by default. 58 | NonVoter bool `json:"non_voter"` 59 | } 60 | 61 | // ReadConfigJSON reads a new-style peers.json and returns a configuration 62 | // structure. This can be used to perform manual recovery when running protocol 63 | // versions that use server IDs. 64 | func ReadConfigJSON(path string) (Configuration, error) { 65 | // Read in the file. 66 | buf, err := ioutil.ReadFile(path) 67 | if err != nil { 68 | return Configuration{}, err 69 | } 70 | 71 | // Parse it as JSON. 72 | var peers []configEntry 73 | dec := json.NewDecoder(bytes.NewReader(buf)) 74 | if err := dec.Decode(&peers); err != nil { 75 | return Configuration{}, err 76 | } 77 | 78 | // Map it into the new-style configuration structure. 79 | var configuration Configuration 80 | for _, peer := range peers { 81 | suffrage := Voter 82 | if peer.NonVoter { 83 | suffrage = Nonvoter 84 | } 85 | server := Server{ 86 | Suffrage: suffrage, 87 | ID: peer.ID, 88 | Address: peer.Address, 89 | } 90 | configuration.Servers = append(configuration.Servers, server) 91 | } 92 | 93 | // We should only ingest valid configurations. 94 | if err := checkConfiguration(configuration); err != nil { 95 | return Configuration{}, err 96 | } 97 | return configuration, nil 98 | } 99 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/raft/stable.go: -------------------------------------------------------------------------------- 1 | package raft 2 | 3 | // StableStore is used to provide stable storage 4 | // of key configurations to ensure safety. 5 | type StableStore interface { 6 | Set(key []byte, val []byte) error 7 | 8 | // Get returns the value for key, or an empty byte slice if key was not found. 9 | Get(key []byte) ([]byte, error) 10 | 11 | SetUint64(key []byte, val uint64) error 12 | 13 | // GetUint64 returns the uint64 value for key, or 0 if key was not found. 14 | GetUint64(key []byte) (uint64, error) 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/raft/tag.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | # The version must be supplied from the environment. Do not include the 5 | # leading "v". 6 | if [ -z $VERSION ]; then 7 | echo "Please specify a version." 8 | exit 1 9 | fi 10 | 11 | # Generate the tag. 12 | echo "==> Tagging version $VERSION..." 13 | git commit --allow-empty -a --gpg-sign=348FFC4C -m "Release v$VERSION" 14 | git tag -a -m "Version $VERSION" -s -u 348FFC4C "v${VERSION}" master 15 | 16 | exit 0 17 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Dave Cheney 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/README.md: -------------------------------------------------------------------------------- 1 | # errors [![Travis-CI](https://travis-ci.org/pkg/errors.svg)](https://travis-ci.org/pkg/errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/b98mptawhudj53ep/branch/master?svg=true)](https://ci.appveyor.com/project/davecheney/errors/branch/master) [![GoDoc](https://godoc.org/github.com/pkg/errors?status.svg)](http://godoc.org/github.com/pkg/errors) [![Report card](https://goreportcard.com/badge/github.com/pkg/errors)](https://goreportcard.com/report/github.com/pkg/errors) [![Sourcegraph](https://sourcegraph.com/github.com/pkg/errors/-/badge.svg)](https://sourcegraph.com/github.com/pkg/errors?badge) 2 | 3 | Package errors provides simple error handling primitives. 4 | 5 | `go get github.com/pkg/errors` 6 | 7 | The traditional error handling idiom in Go is roughly akin to 8 | ```go 9 | if err != nil { 10 | return err 11 | } 12 | ``` 13 | which applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error. 14 | 15 | ## Adding context to an error 16 | 17 | The errors.Wrap function returns a new error that adds context to the original error. For example 18 | ```go 19 | _, err := ioutil.ReadAll(r) 20 | if err != nil { 21 | return errors.Wrap(err, "read failed") 22 | } 23 | ``` 24 | ## Retrieving the cause of an error 25 | 26 | Using `errors.Wrap` constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by `errors.Cause`. 27 | ```go 28 | type causer interface { 29 | Cause() error 30 | } 31 | ``` 32 | `errors.Cause` will recursively retrieve the topmost error which does not implement `causer`, which is assumed to be the original cause. For example: 33 | ```go 34 | switch err := errors.Cause(err).(type) { 35 | case *MyError: 36 | // handle specifically 37 | default: 38 | // unknown error 39 | } 40 | ``` 41 | 42 | [Read the package documentation for more information](https://godoc.org/github.com/pkg/errors). 43 | 44 | ## Contributing 45 | 46 | We welcome pull requests, bug fixes and issue reports. With that said, the bar for adding new symbols to this package is intentionally set high. 47 | 48 | Before proposing a change, please discuss your change by raising an issue. 49 | 50 | ## License 51 | 52 | BSD-2-Clause 53 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: build-{build}.{branch} 2 | 3 | clone_folder: C:\gopath\src\github.com\pkg\errors 4 | shallow_clone: true # for startup speed 5 | 6 | environment: 7 | GOPATH: C:\gopath 8 | 9 | platform: 10 | - x64 11 | 12 | # http://www.appveyor.com/docs/installed-software 13 | install: 14 | # some helpful output for debugging builds 15 | - go version 16 | - go env 17 | # pre-installed MinGW at C:\MinGW is 32bit only 18 | # but MSYS2 at C:\msys64 has mingw64 19 | - set PATH=C:\msys64\mingw64\bin;%PATH% 20 | - gcc --version 21 | - g++ --version 22 | 23 | build_script: 24 | - go install -v ./... 25 | 26 | test_script: 27 | - set PATH=C:\gopath\bin;%PATH% 28 | - go test -v ./... 29 | 30 | #artifacts: 31 | # - path: '%GOPATH%\bin\*.exe' 32 | deploy: off 33 | -------------------------------------------------------------------------------- /vendor/github.com/siddontang/goredis/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 siddontang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /vendor/github.com/siddontang/goredis/doc.go: -------------------------------------------------------------------------------- 1 | // Package goredis is a client for the redis and ledisdb. 2 | // 3 | // Client 4 | // 5 | // The client is the primary interface for redis. You must first create a client with redis address for working. 6 | // 7 | // c := NewClient("127.0.0.1:6380") 8 | // 9 | // The most important function for client is Do function to send commands to remote server. 10 | // 11 | // reply, err := c.Do("ping") 12 | // 13 | // reply, err := c.Do("set", "key", "value") 14 | // 15 | // reply, err := c.Do("get", "key") 16 | // 17 | // Connection 18 | // 19 | // You can use an independent connection to send commands. 20 | // 21 | // //get a connection 22 | // conn, _ := c.Get() 23 | // 24 | // //connection send command 25 | // conn.Do("ping") 26 | // 27 | // Reply Helper 28 | // 29 | // You can use reply helper to convert a reply to a specific type. 30 | // 31 | // exists, err := Bool(c.Do("exists", "key")) 32 | // 33 | // score, err := Int64(c.Do("zscore", "key", "member")) 34 | package goredis 35 | -------------------------------------------------------------------------------- /vendor/github.com/siddontang/goredis/garyburd_license: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. -------------------------------------------------------------------------------- /vendor/github.com/yongman/go/goredis/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 siddontang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /vendor/github.com/yongman/go/goredis/doc.go: -------------------------------------------------------------------------------- 1 | // Package goredis is a client for the redis and ledisdb. 2 | // 3 | // Client 4 | // 5 | // The client is the primary interface for redis. You must first create a client with redis address for working. 6 | // 7 | // c := NewClient("127.0.0.1:6380") 8 | // 9 | // The most important function for client is Do function to send commands to remote server. 10 | // 11 | // reply, err := c.Do("ping") 12 | // 13 | // reply, err := c.Do("set", "key", "value") 14 | // 15 | // reply, err := c.Do("get", "key") 16 | // 17 | // Connection 18 | // 19 | // You can use an independent connection to send commands. 20 | // 21 | // //get a connection 22 | // conn, _ := c.Get() 23 | // 24 | // //connection send command 25 | // conn.Do("ping") 26 | // 27 | // Reply Helper 28 | // 29 | // You can use reply helper to convert a reply to a specific type. 30 | // 31 | // exists, err := Bool(c.Do("exists", "key")) 32 | // 33 | // score, err := Int64(c.Do("zscore", "key", "member")) 34 | package goredis 35 | -------------------------------------------------------------------------------- /vendor/github.com/yongman/go/goredis/garyburd_license: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Gary Burd 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 | // not use this file except in compliance with the License. You may obtain 5 | // a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. -------------------------------------------------------------------------------- /vendor/golang.org/x/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/context/context.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package context defines the Context type, which carries deadlines, 6 | // cancelation signals, and other request-scoped values across API boundaries 7 | // and between processes. 8 | // As of Go 1.7 this package is available in the standard library under the 9 | // name context. https://golang.org/pkg/context. 10 | // 11 | // Incoming requests to a server should create a Context, and outgoing calls to 12 | // servers should accept a Context. The chain of function calls between must 13 | // propagate the Context, optionally replacing it with a modified copy created 14 | // using WithDeadline, WithTimeout, WithCancel, or WithValue. 15 | // 16 | // Programs that use Contexts should follow these rules to keep interfaces 17 | // consistent across packages and enable static analysis tools to check context 18 | // propagation: 19 | // 20 | // Do not store Contexts inside a struct type; instead, pass a Context 21 | // explicitly to each function that needs it. The Context should be the first 22 | // parameter, typically named ctx: 23 | // 24 | // func DoSomething(ctx context.Context, arg Arg) error { 25 | // // ... use ctx ... 26 | // } 27 | // 28 | // Do not pass a nil Context, even if a function permits it. Pass context.TODO 29 | // if you are unsure about which Context to use. 30 | // 31 | // Use context Values only for request-scoped data that transits processes and 32 | // APIs, not for passing optional parameters to functions. 33 | // 34 | // The same Context may be passed to functions running in different goroutines; 35 | // Contexts are safe for simultaneous use by multiple goroutines. 36 | // 37 | // See http://blog.golang.org/context for example code for a server that uses 38 | // Contexts. 39 | package context // import "golang.org/x/net/context" 40 | 41 | // Background returns a non-nil, empty Context. It is never canceled, has no 42 | // values, and has no deadline. It is typically used by the main function, 43 | // initialization, and tests, and as the top-level Context for incoming 44 | // requests. 45 | func Background() Context { 46 | return background 47 | } 48 | 49 | // TODO returns a non-nil, empty Context. Code should use context.TODO when 50 | // it's unclear which Context to use or it is not yet available (because the 51 | // surrounding function has not yet been extended to accept a Context 52 | // parameter). TODO is recognized by static analysis tools that determine 53 | // whether Contexts are propagated correctly in a program. 54 | func TODO() Context { 55 | return todo 56 | } 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/context/go17.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.7 6 | 7 | package context 8 | 9 | import ( 10 | "context" // standard library's context, as of Go 1.7 11 | "time" 12 | ) 13 | 14 | var ( 15 | todo = context.TODO() 16 | background = context.Background() 17 | ) 18 | 19 | // Canceled is the error returned by Context.Err when the context is canceled. 20 | var Canceled = context.Canceled 21 | 22 | // DeadlineExceeded is the error returned by Context.Err when the context's 23 | // deadline passes. 24 | var DeadlineExceeded = context.DeadlineExceeded 25 | 26 | // WithCancel returns a copy of parent with a new Done channel. The returned 27 | // context's Done channel is closed when the returned cancel function is called 28 | // or when the parent context's Done channel is closed, whichever happens first. 29 | // 30 | // Canceling this context releases resources associated with it, so code should 31 | // call cancel as soon as the operations running in this Context complete. 32 | func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { 33 | ctx, f := context.WithCancel(parent) 34 | return ctx, CancelFunc(f) 35 | } 36 | 37 | // WithDeadline returns a copy of the parent context with the deadline adjusted 38 | // to be no later than d. If the parent's deadline is already earlier than d, 39 | // WithDeadline(parent, d) is semantically equivalent to parent. The returned 40 | // context's Done channel is closed when the deadline expires, when the returned 41 | // cancel function is called, or when the parent context's Done channel is 42 | // closed, whichever happens first. 43 | // 44 | // Canceling this context releases resources associated with it, so code should 45 | // call cancel as soon as the operations running in this Context complete. 46 | func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) { 47 | ctx, f := context.WithDeadline(parent, deadline) 48 | return ctx, CancelFunc(f) 49 | } 50 | 51 | // WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)). 52 | // 53 | // Canceling this context releases resources associated with it, so code should 54 | // call cancel as soon as the operations running in this Context complete: 55 | // 56 | // func slowOperationWithTimeout(ctx context.Context) (Result, error) { 57 | // ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond) 58 | // defer cancel() // releases resources if slowOperation completes before timeout elapses 59 | // return slowOperation(ctx) 60 | // } 61 | func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) { 62 | return WithDeadline(parent, time.Now().Add(timeout)) 63 | } 64 | 65 | // WithValue returns a copy of parent in which the value associated with key is 66 | // val. 67 | // 68 | // Use context Values only for request-scoped data that transits processes and 69 | // APIs, not for passing optional parameters to functions. 70 | func WithValue(parent Context, key interface{}, val interface{}) Context { 71 | return context.WithValue(parent, key, val) 72 | } 73 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/context/go19.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.9 6 | 7 | package context 8 | 9 | import "context" // standard library's context, as of Go 1.7 10 | 11 | // A Context carries a deadline, a cancelation signal, and other values across 12 | // API boundaries. 13 | // 14 | // Context's methods may be called by multiple goroutines simultaneously. 15 | type Context = context.Context 16 | 17 | // A CancelFunc tells an operation to abandon its work. 18 | // A CancelFunc does not wait for the work to stop. 19 | // After the first call, subsequent calls to a CancelFunc do nothing. 20 | type CancelFunc = context.CancelFunc 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/trace/trace_go16.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !go1.7 6 | 7 | package trace 8 | 9 | import "golang.org/x/net/context" 10 | 11 | // NewContext returns a copy of the parent context 12 | // and associates it with a Trace. 13 | func NewContext(ctx context.Context, tr Trace) context.Context { 14 | return context.WithValue(ctx, contextKey, tr) 15 | } 16 | 17 | // FromContext returns the Trace bound to the context, if any. 18 | func FromContext(ctx context.Context) (tr Trace, ok bool) { 19 | tr, ok = ctx.Value(contextKey).(Trace) 20 | return 21 | } 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/trace/trace_go17.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.7 6 | 7 | package trace 8 | 9 | import "context" 10 | 11 | // NewContext returns a copy of the parent context 12 | // and associates it with a Trace. 13 | func NewContext(ctx context.Context, tr Trace) context.Context { 14 | return context.WithValue(ctx, contextKey, tr) 15 | } 16 | 17 | // FromContext returns the Trace bound to the context, if any. 18 | func FromContext(ctx context.Context) (tr Trace, ok bool) { 19 | tr, ok = ctx.Value(contextKey).(Trace) 20 | return 21 | } 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for ARM, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-28 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm64,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for AMD64, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-56 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, DragonFly 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-64 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-88 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-112 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-64 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-88 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for 386, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 23 | JMP syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 26 | JMP syscall·RawSyscall6(SB) 27 | 28 | TEXT ·socketcall(SB),NOSPLIT,$0-36 29 | JMP syscall·socketcall(SB) 30 | 31 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 32 | JMP syscall·rawsocketcall(SB) 33 | 34 | TEXT ·seek(SB),NOSPLIT,$0-28 35 | JMP syscall·seek(SB) 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for AMD64, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 23 | JMP syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 26 | JMP syscall·RawSyscall6(SB) 27 | 28 | TEXT ·gettimeofday(SB),NOSPLIT,$0-16 29 | JMP syscall·gettimeofday(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for arm, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 23 | B syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 26 | B syscall·RawSyscall6(SB) 27 | 28 | TEXT ·seek(SB),NOSPLIT,$0-32 29 | B syscall·seek(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build arm64 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-56 15 | B syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 18 | B syscall·Syscall6(SB) 19 | 20 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 21 | B syscall·RawSyscall(SB) 22 | 23 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 24 | B syscall·RawSyscall6(SB) 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mips64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build mips64 mips64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for mips64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | JMP syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | JMP syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mipsx.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build mips mipsle 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for mips, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-28 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 25 | JMP syscall·Syscall9(SB) 26 | 27 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 28 | JMP syscall·RawSyscall(SB) 29 | 30 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 31 | JMP syscall·RawSyscall6(SB) 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build ppc64 ppc64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for ppc64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | BR syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | BR syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_s390x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build s390x 6 | // +build linux 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for s390x, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | BR syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | BR syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go 11 | // 12 | 13 | TEXT ·sysvicall6(SB),NOSPLIT,$0-88 14 | JMP syscall·sysvicall6(SB) 15 | 16 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88 17 | JMP syscall·rawSysvicall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/bluetooth_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Bluetooth sockets and messages 6 | 7 | package unix 8 | 9 | // Bluetooth Protocols 10 | const ( 11 | BTPROTO_L2CAP = 0 12 | BTPROTO_HCI = 1 13 | BTPROTO_SCO = 2 14 | BTPROTO_RFCOMM = 3 15 | BTPROTO_BNEP = 4 16 | BTPROTO_CMTP = 5 17 | BTPROTO_HIDP = 6 18 | BTPROTO_AVDTP = 7 19 | ) 20 | 21 | const ( 22 | HCI_CHANNEL_RAW = 0 23 | HCI_CHANNEL_USER = 1 24 | HCI_CHANNEL_MONITOR = 2 25 | HCI_CHANNEL_CONTROL = 3 26 | ) 27 | 28 | // Socketoption Level 29 | const ( 30 | SOL_BLUETOOTH = 0x112 31 | SOL_HCI = 0x0 32 | SOL_L2CAP = 0x6 33 | SOL_RFCOMM = 0x12 34 | SOL_SCO = 0x11 35 | ) 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | const ( 10 | R_OK = 0x4 11 | W_OK = 0x2 12 | X_OK = 0x1 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in Darwin's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a Darwin device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev >> 24) & 0xff) 13 | } 14 | 15 | // Minor returns the minor component of a Darwin device number. 16 | func Minor(dev uint64) uint32 { 17 | return uint32(dev & 0xffffff) 18 | } 19 | 20 | // Mkdev returns a Darwin device number generated from the given major and minor 21 | // components. 22 | func Mkdev(major, minor uint32) uint64 { 23 | return (uint64(major) << 24) | uint64(minor) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in Dragonfly's sys/types.h header. 7 | // 8 | // The information below is extracted and adapted from sys/types.h: 9 | // 10 | // Minor gives a cookie instead of an index since in order to avoid changing the 11 | // meanings of bits 0-15 or wasting time and space shifting bits 16-31 for 12 | // devices that don't use them. 13 | 14 | package unix 15 | 16 | // Major returns the major component of a DragonFlyBSD device number. 17 | func Major(dev uint64) uint32 { 18 | return uint32((dev >> 8) & 0xff) 19 | } 20 | 21 | // Minor returns the minor component of a DragonFlyBSD device number. 22 | func Minor(dev uint64) uint32 { 23 | return uint32(dev & 0xffff00ff) 24 | } 25 | 26 | // Mkdev returns a DragonFlyBSD device number generated from the given major and 27 | // minor components. 28 | func Mkdev(major, minor uint32) uint64 { 29 | return (uint64(major) << 8) | uint64(minor) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_freebsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in FreeBSD's sys/types.h header. 7 | // 8 | // The information below is extracted and adapted from sys/types.h: 9 | // 10 | // Minor gives a cookie instead of an index since in order to avoid changing the 11 | // meanings of bits 0-15 or wasting time and space shifting bits 16-31 for 12 | // devices that don't use them. 13 | 14 | package unix 15 | 16 | // Major returns the major component of a FreeBSD device number. 17 | func Major(dev uint64) uint32 { 18 | return uint32((dev >> 8) & 0xff) 19 | } 20 | 21 | // Minor returns the minor component of a FreeBSD device number. 22 | func Minor(dev uint64) uint32 { 23 | return uint32(dev & 0xffff00ff) 24 | } 25 | 26 | // Mkdev returns a FreeBSD device number generated from the given major and 27 | // minor components. 28 | func Mkdev(major, minor uint32) uint64 { 29 | return (uint64(major) << 8) | uint64(minor) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used by the Linux kernel and glibc. 7 | // 8 | // The information below is extracted and adapted from bits/sysmacros.h in the 9 | // glibc sources: 10 | // 11 | // dev_t in glibc is 64-bit, with 32-bit major and minor numbers. glibc's 12 | // default encoding is MMMM Mmmm mmmM MMmm, where M is a hex digit of the major 13 | // number and m is a hex digit of the minor number. This is backward compatible 14 | // with legacy systems where dev_t is 16 bits wide, encoded as MMmm. It is also 15 | // backward compatible with the Linux kernel, which for some architectures uses 16 | // 32-bit dev_t, encoded as mmmM MMmm. 17 | 18 | package unix 19 | 20 | // Major returns the major component of a Linux device number. 21 | func Major(dev uint64) uint32 { 22 | major := uint32((dev & 0x00000000000fff00) >> 8) 23 | major |= uint32((dev & 0xfffff00000000000) >> 32) 24 | return major 25 | } 26 | 27 | // Minor returns the minor component of a Linux device number. 28 | func Minor(dev uint64) uint32 { 29 | minor := uint32((dev & 0x00000000000000ff) >> 0) 30 | minor |= uint32((dev & 0x00000ffffff00000) >> 12) 31 | return minor 32 | } 33 | 34 | // Mkdev returns a Linux device number generated from the given major and minor 35 | // components. 36 | func Mkdev(major, minor uint32) uint64 { 37 | dev := (uint64(major) & 0x00000fff) << 8 38 | dev |= (uint64(major) & 0xfffff000) << 32 39 | dev |= (uint64(minor) & 0x000000ff) << 0 40 | dev |= (uint64(minor) & 0xffffff00) << 12 41 | return dev 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in NetBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a NetBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x000fff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of a NetBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xfff00000) >> 12) 19 | return minor 20 | } 21 | 22 | // Mkdev returns a NetBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x000fff00 26 | dev |= (uint64(minor) << 12) & 0xfff00000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in OpenBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of an OpenBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x0000ff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of an OpenBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xffff0000) >> 8) 19 | return minor 20 | } 21 | 22 | // Mkdev returns an OpenBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x0000ff00 26 | dev |= (uint64(minor) << 8) & 0xffff0000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_big.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | // +build ppc64 s390x mips mips64 6 | 7 | package unix 8 | 9 | const isBigEndian = true 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_little.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | // +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le 6 | 7 | package unix 8 | 9 | const isBigEndian = false 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Unix environment variables. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getenv(key string) (value string, found bool) { 14 | return syscall.Getenv(key) 15 | } 16 | 17 | func Setenv(key, value string) error { 18 | return syscall.Setenv(key, value) 19 | } 20 | 21 | func Clearenv() { 22 | syscall.Clearenv() 23 | } 24 | 25 | func Environ() []string { 26 | return syscall.Environ() 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unset.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.4 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | func Unsetenv(key string) error { 12 | // This was added in Go 1.4. 13 | return syscall.Unsetenv(key) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/file_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import ( 8 | "os" 9 | "syscall" 10 | ) 11 | 12 | // FIXME: unexported function from os 13 | // syscallMode returns the syscall-specific mode bits from Go's portable mode bits. 14 | func syscallMode(i os.FileMode) (o uint32) { 15 | o |= uint32(i.Perm()) 16 | if i&os.ModeSetuid != 0 { 17 | o |= syscall.S_ISUID 18 | } 19 | if i&os.ModeSetgid != 0 { 20 | o |= syscall.S_ISGID 21 | } 22 | if i&os.ModeSticky != 0 { 23 | o |= syscall.S_ISVTX 24 | } 25 | // No mapping for Go's ModeTemporary (plan9 only). 26 | return 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/flock.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux 12 | // systems by flock_linux_32bit.go to be SYS_FCNTL64. 13 | var fcntl64Syscall uintptr = SYS_FCNTL 14 | 15 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 16 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 17 | _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk))) 18 | if errno == 0 { 19 | return nil 20 | } 21 | return errno 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/flock_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // +build linux,386 linux,arm linux,mips linux,mipsle 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | package unix 8 | 9 | func init() { 10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's 11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL. 12 | fcntl64Syscall = SYS_FCNTL64 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // We can't use the gc-syntax .s files for gccgo. On the plus side 12 | // much of the functionality can be written directly in Go. 13 | 14 | //extern gccgoRealSyscall 15 | func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr) 16 | 17 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 18 | syscall.Entersyscall() 19 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 20 | syscall.Exitsyscall() 21 | return r, 0, syscall.Errno(errno) 22 | } 23 | 24 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 25 | syscall.Entersyscall() 26 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 27 | syscall.Exitsyscall() 28 | return r, 0, syscall.Errno(errno) 29 | } 30 | 31 | func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) { 32 | syscall.Entersyscall() 33 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9) 34 | syscall.Exitsyscall() 35 | return r, 0, syscall.Errno(errno) 36 | } 37 | 38 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 39 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 40 | return r, 0, syscall.Errno(errno) 41 | } 42 | 43 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 44 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 45 | return r, 0, syscall.Errno(errno) 46 | } 47 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_c.c: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #define _STRINGIFY2_(x) #x 12 | #define _STRINGIFY_(x) _STRINGIFY2_(x) 13 | #define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__) 14 | 15 | // Call syscall from C code because the gccgo support for calling from 16 | // Go to C does not support varargs functions. 17 | 18 | struct ret { 19 | uintptr_t r; 20 | uintptr_t err; 21 | }; 22 | 23 | struct ret 24 | gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) 25 | { 26 | struct ret r; 27 | 28 | errno = 0; 29 | r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 30 | r.err = errno; 31 | return r; 32 | } 33 | 34 | // Define the use function in C so that it is not inlined. 35 | 36 | extern void use(void *) __asm__ (GOSYM_PREFIX GOPKGPATH ".use") __attribute__((noinline)); 37 | 38 | void 39 | use(void *p __attribute__ ((unused))) 40 | { 41 | } 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo,linux,amd64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern gettimeofday 12 | func realGettimeofday(*Timeval, *byte) int32 13 | 14 | func gettimeofday(tv *Timeval) (err syscall.Errno) { 15 | r := realGettimeofday(tv, nil) 16 | if r < 0 { 17 | return syscall.GetErrno() 18 | } 19 | return 0 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/mkpost.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // mkpost processes the output of cgo -godefs to 8 | // modify the generated types. It is used to clean up 9 | // the sys API in an architecture specific manner. 10 | // 11 | // mkpost is run after cgo -godefs; see README.md. 12 | package main 13 | 14 | import ( 15 | "bytes" 16 | "fmt" 17 | "go/format" 18 | "io/ioutil" 19 | "log" 20 | "os" 21 | "regexp" 22 | ) 23 | 24 | func main() { 25 | // Get the OS and architecture (using GOARCH_TARGET if it exists) 26 | goos := os.Getenv("GOOS") 27 | goarch := os.Getenv("GOARCH_TARGET") 28 | if goarch == "" { 29 | goarch = os.Getenv("GOARCH") 30 | } 31 | // Check that we are using the new build system if we should be. 32 | if goos == "linux" && goarch != "sparc64" { 33 | if os.Getenv("GOLANG_SYS_BUILD") != "docker" { 34 | os.Stderr.WriteString("In the new build system, mkpost should not be called directly.\n") 35 | os.Stderr.WriteString("See README.md\n") 36 | os.Exit(1) 37 | } 38 | } 39 | 40 | b, err := ioutil.ReadAll(os.Stdin) 41 | if err != nil { 42 | log.Fatal(err) 43 | } 44 | 45 | // If we have empty Ptrace structs, we should delete them. Only s390x emits 46 | // nonempty Ptrace structs. 47 | ptraceRexexp := regexp.MustCompile(`type Ptrace((Psw|Fpregs|Per) struct {\s*})`) 48 | b = ptraceRexexp.ReplaceAll(b, nil) 49 | 50 | // Replace the control_regs union with a blank identifier for now. 51 | controlRegsRegex := regexp.MustCompile(`(Control_regs)\s+\[0\]uint64`) 52 | b = controlRegsRegex.ReplaceAll(b, []byte("_ [0]uint64")) 53 | 54 | // Remove fields that are added by glibc 55 | // Note that this is unstable as the identifers are private. 56 | removeFieldsRegex := regexp.MustCompile(`X__glibc\S*`) 57 | b = removeFieldsRegex.ReplaceAll(b, []byte("_")) 58 | 59 | // Convert [65]int8 to [65]byte in Utsname members to simplify 60 | // conversion to string; see golang.org/issue/20753 61 | convertUtsnameRegex := regexp.MustCompile(`((Sys|Node|Domain)name|Release|Version|Machine)(\s+)\[(\d+)\]u?int8`) 62 | b = convertUtsnameRegex.ReplaceAll(b, []byte("$1$3[$4]byte")) 63 | 64 | // We refuse to export private fields on s390x 65 | if goarch == "s390x" && goos == "linux" { 66 | // Remove cgo padding fields 67 | removeFieldsRegex := regexp.MustCompile(`Pad_cgo_\d+`) 68 | b = removeFieldsRegex.ReplaceAll(b, []byte("_")) 69 | 70 | // Remove padding, hidden, or unused fields 71 | removeFieldsRegex = regexp.MustCompile(`X_\S+`) 72 | b = removeFieldsRegex.ReplaceAll(b, []byte("_")) 73 | } 74 | 75 | // Remove the first line of warning from cgo 76 | b = b[bytes.IndexByte(b, '\n')+1:] 77 | // Modify the command in the header to include: 78 | // mkpost, our own warning, and a build tag. 79 | replacement := fmt.Sprintf(`$1 | go run mkpost.go 80 | // Code generated by the command above; see README.md. DO NOT EDIT. 81 | 82 | // +build %s,%s`, goarch, goos) 83 | cgoCommandRegex := regexp.MustCompile(`(cgo -godefs .*)`) 84 | b = cgoCommandRegex.ReplaceAll(b, []byte(replacement)) 85 | 86 | // gofmt 87 | b, err = format.Source(b) 88 | if err != nil { 89 | log.Fatal(err) 90 | } 91 | 92 | os.Stdout.Write(b) 93 | } 94 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/mksysnum_darwin.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # Copyright 2009 The Go Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file. 5 | # 6 | # Generate system call table for Darwin from sys/syscall.h 7 | 8 | use strict; 9 | 10 | if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { 11 | print STDERR "GOARCH or GOOS not defined in environment\n"; 12 | exit 1; 13 | } 14 | 15 | my $command = "mksysnum_darwin.pl " . join(' ', @ARGV); 16 | 17 | print <){ 29 | if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){ 30 | my $name = $1; 31 | my $num = $2; 32 | $name =~ y/a-z/A-Z/; 33 | print " SYS_$name = $num;" 34 | } 35 | } 36 | 37 | print <){ 30 | if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $2; 33 | my $name = "SYS_$3"; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <){ 30 | if(/^([0-9]+)\s+\S+\s+STD\s+({ \S+\s+(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $2; 33 | my $name = "SYS_$3"; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <){ 31 | if($line =~ /^(.*)\\$/) { 32 | # Handle continuation 33 | $line = $1; 34 | $_ =~ s/^\s+//; 35 | $line .= $_; 36 | } else { 37 | # New line 38 | $line = $_; 39 | } 40 | next if $line =~ /\\$/; 41 | if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) { 42 | my $num = $1; 43 | my $proto = $6; 44 | my $compat = $8; 45 | my $name = "$7_$9"; 46 | 47 | $name = "$7_$11" if $11 ne ''; 48 | $name =~ y/a-z/A-Z/; 49 | 50 | if($compat eq '' || $compat eq '13' || $compat eq '30' || $compat eq '50') { 51 | print " $name = $num; // $proto\n"; 52 | } 53 | } 54 | } 55 | 56 | print <){ 30 | if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $3; 33 | my $name = $4; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <= 10 { 20 | buf[i] = byte(val%10 + '0') 21 | i-- 22 | val /= 10 23 | } 24 | buf[i] = byte(val + '0') 25 | return string(buf[i:]) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Package unix contains an interface to the low-level operating system 8 | // primitives. OS details vary depending on the underlying system, and 9 | // by default, godoc will display OS-specific documentation for the current 10 | // system. If you want godoc to display OS documentation for another 11 | // system, set $GOOS and $GOARCH to the desired system. For example, if 12 | // you want to view documentation for freebsd/arm on linux/amd64, set $GOOS 13 | // to freebsd and $GOARCH to arm. 14 | // The primary use of this package is inside other packages that provide a more 15 | // portable interface to the system, such as "os", "time" and "net". Use 16 | // those packages rather than this one if you can. 17 | // For details of the functions and data types in this package consult 18 | // the manuals for the appropriate operating system. 19 | // These calls return err == nil to indicate success; otherwise 20 | // err represents an operating system error describing the failure and 21 | // holds a value of type syscall.Errno. 22 | package unix // import "golang.org/x/sys/unix" 23 | 24 | // ByteSliceFromString returns a NUL-terminated slice of bytes 25 | // containing the text of s. If s contains a NUL byte at any 26 | // location, it returns (nil, EINVAL). 27 | func ByteSliceFromString(s string) ([]byte, error) { 28 | for i := 0; i < len(s); i++ { 29 | if s[i] == 0 { 30 | return nil, EINVAL 31 | } 32 | } 33 | a := make([]byte, len(s)+1) 34 | copy(a, s) 35 | return a, nil 36 | } 37 | 38 | // BytePtrFromString returns a pointer to a NUL-terminated array of 39 | // bytes containing the text of s. If s contains a NUL byte at any 40 | // location, it returns (nil, EINVAL). 41 | func BytePtrFromString(s string) (*byte, error) { 42 | a, err := ByteSliceFromString(s) 43 | if err != nil { 44 | return nil, err 45 | } 46 | return &a[0], nil 47 | } 48 | 49 | // Single-word zero for use when we need a valid pointer to 0 bytes. 50 | // See mkunix.pl. 51 | var _zero uintptr 52 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 20 | } 21 | 22 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 23 | func Gettimeofday(tv *Timeval) (err error) { 24 | // The tv passed to gettimeofday must be non-nil 25 | // but is otherwise unused. The answers come back 26 | // in the two registers. 27 | sec, usec, err := gettimeofday(tv) 28 | tv.Sec = int32(sec) 29 | tv.Usec = int32(usec) 30 | return err 31 | } 32 | 33 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 34 | k.Ident = uint32(fd) 35 | k.Filter = int16(mode) 36 | k.Flags = uint16(flags) 37 | } 38 | 39 | func (iov *Iovec) SetLen(length int) { 40 | iov.Len = uint32(length) 41 | } 42 | 43 | func (msghdr *Msghdr) SetControllen(length int) { 44 | msghdr.Controllen = uint32(length) 45 | } 46 | 47 | func (cmsg *Cmsghdr) SetLen(length int) { 48 | cmsg.Len = uint32(length) 49 | } 50 | 51 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 52 | var length = uint64(count) 53 | 54 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0) 55 | 56 | written = int(length) 57 | 58 | if e1 != 0 { 59 | err = e1 60 | } 61 | return 62 | } 63 | 64 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 65 | 66 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 67 | // of darwin/386 the syscall is called sysctl instead of __sysctl. 68 | const SYS___SYSCTL = SYS_SYSCTL 69 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: int32(usec)} 20 | } 21 | 22 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 23 | func Gettimeofday(tv *Timeval) (err error) { 24 | // The tv passed to gettimeofday must be non-nil 25 | // but is otherwise unused. The answers come back 26 | // in the two registers. 27 | sec, usec, err := gettimeofday(tv) 28 | tv.Sec = sec 29 | tv.Usec = usec 30 | return err 31 | } 32 | 33 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 34 | k.Ident = uint64(fd) 35 | k.Filter = int16(mode) 36 | k.Flags = uint16(flags) 37 | } 38 | 39 | func (iov *Iovec) SetLen(length int) { 40 | iov.Len = uint64(length) 41 | } 42 | 43 | func (msghdr *Msghdr) SetControllen(length int) { 44 | msghdr.Controllen = uint32(length) 45 | } 46 | 47 | func (cmsg *Cmsghdr) SetLen(length int) { 48 | cmsg.Len = uint32(length) 49 | } 50 | 51 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 52 | var length = uint64(count) 53 | 54 | _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0) 55 | 56 | written = int(length) 57 | 58 | if e1 != 0 { 59 | err = e1 60 | } 61 | return 62 | } 63 | 64 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 65 | 66 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 67 | // of darwin/amd64 the syscall is called sysctl instead of __sysctl. 68 | const SYS___SYSCTL = SYS_SYSCTL 69 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import ( 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | func setTimespec(sec, nsec int64) Timespec { 13 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 14 | } 15 | 16 | func setTimeval(sec, usec int64) Timeval { 17 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 18 | } 19 | 20 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 21 | func Gettimeofday(tv *Timeval) (err error) { 22 | // The tv passed to gettimeofday must be non-nil 23 | // but is otherwise unused. The answers come back 24 | // in the two registers. 25 | sec, usec, err := gettimeofday(tv) 26 | tv.Sec = int32(sec) 27 | tv.Usec = int32(usec) 28 | return err 29 | } 30 | 31 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 32 | k.Ident = uint32(fd) 33 | k.Filter = int16(mode) 34 | k.Flags = uint16(flags) 35 | } 36 | 37 | func (iov *Iovec) SetLen(length int) { 38 | iov.Len = uint32(length) 39 | } 40 | 41 | func (msghdr *Msghdr) SetControllen(length int) { 42 | msghdr.Controllen = uint32(length) 43 | } 44 | 45 | func (cmsg *Cmsghdr) SetLen(length int) { 46 | cmsg.Len = uint32(length) 47 | } 48 | 49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 50 | var length = uint64(count) 51 | 52 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0) 53 | 54 | written = int(length) 55 | 56 | if e1 != 0 { 57 | err = e1 58 | } 59 | return 60 | } 61 | 62 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 63 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: int32(usec)} 20 | } 21 | 22 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 23 | func Gettimeofday(tv *Timeval) (err error) { 24 | // The tv passed to gettimeofday must be non-nil 25 | // but is otherwise unused. The answers come back 26 | // in the two registers. 27 | sec, usec, err := gettimeofday(tv) 28 | tv.Sec = sec 29 | tv.Usec = usec 30 | return err 31 | } 32 | 33 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 34 | k.Ident = uint64(fd) 35 | k.Filter = int16(mode) 36 | k.Flags = uint16(flags) 37 | } 38 | 39 | func (iov *Iovec) SetLen(length int) { 40 | iov.Len = uint64(length) 41 | } 42 | 43 | func (msghdr *Msghdr) SetControllen(length int) { 44 | msghdr.Controllen = uint32(length) 45 | } 46 | 47 | func (cmsg *Cmsghdr) SetLen(length int) { 48 | cmsg.Len = uint32(length) 49 | } 50 | 51 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 52 | var length = uint64(count) 53 | 54 | _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0) 55 | 56 | written = int(length) 57 | 58 | if e1 != 0 { 59 | err = e1 60 | } 61 | return 62 | } 63 | 64 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 65 | 66 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 67 | // of darwin/arm64 the syscall is called sysctl instead of __sysctl. 68 | const SYS___SYSCTL = SYS_SYSCTL 69 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: usec} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint64(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint64(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint32(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: usec} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint64(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint64(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: int32(nsec)} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: int32(usec)} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint32(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,linux 6 | // +build !gccgo 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | //go:noescape 13 | func gettimeofday(tv *Timeval) (err syscall.Errno) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_no_getwd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build dragonfly freebsd netbsd openbsd 6 | 7 | package unix 8 | 9 | const ImplementsGetwd = false 10 | 11 | func Getwd() (string, error) { return "", ENOTSUP } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func (iov *Iovec) SetLen(length int) { 18 | iov.Len = uint64(length) 19 | } 20 | 21 | func (cmsg *Cmsghdr) SetLen(length int) { 22 | cmsg.Len = uint32(length) 23 | } 24 | 25 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 26 | // TODO(aram): implement this, see issue 5847. 27 | panic("unimplemented") 28 | } 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_unix_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | // +build !gccgo 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 13 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 14 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 15 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/timestruct.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | // TimespecToNsec converts a Timespec value into a number of 10 | // nanoseconds since the Unix epoch. 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | // NsecToTimespec takes a number of nanoseconds since the Unix epoch 14 | // and returns the corresponding Timespec value. 15 | func NsecToTimespec(nsec int64) Timespec { 16 | sec := nsec / 1e9 17 | nsec = nsec % 1e9 18 | if nsec < 0 { 19 | nsec += 1e9 20 | sec-- 21 | } 22 | return setTimespec(sec, nsec) 23 | } 24 | 25 | // TimevalToNsec converts a Timeval value into a number of nanoseconds 26 | // since the Unix epoch. 27 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 28 | 29 | // NsecToTimeval takes a number of nanoseconds since the Unix epoch 30 | // and returns the corresponding Timeval value. 31 | func NsecToTimeval(nsec int64) Timeval { 32 | nsec += 999 // round up to microsecond 33 | usec := nsec % 1e9 / 1e3 34 | sec := nsec / 1e9 35 | if usec < 0 { 36 | usec += 1e6 37 | sec-- 38 | } 39 | return setTimeval(sec, usec) 40 | } 41 | 42 | // Unix returns ts as the number of seconds and nanoseconds elapsed since the 43 | // Unix epoch. 44 | func (ts *Timespec) Unix() (sec int64, nsec int64) { 45 | return int64(ts.Sec), int64(ts.Nsec) 46 | } 47 | 48 | // Unix returns tv as the number of seconds and nanoseconds elapsed since the 49 | // Unix epoch. 50 | func (tv *Timeval) Unix() (sec int64, nsec int64) { 51 | return int64(tv.Sec), int64(tv.Usec) * 1000 52 | } 53 | 54 | // Nano returns ts as the number of nanoseconds elapsed since the Unix epoch. 55 | func (ts *Timespec) Nano() int64 { 56 | return int64(ts.Sec)*1e9 + int64(ts.Nsec) 57 | } 58 | 59 | // Nano returns tv as the number of nanoseconds elapsed since the Unix epoch. 60 | func (tv *Timeval) Nano() int64 { 61 | return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000 62 | } 63 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptrace386_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(386, amd64). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build 386 amd64 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegs386 is the registers used by 386 binaries. 11 | type PtraceRegs386 struct { 12 | Ebx int32 13 | Ecx int32 14 | Edx int32 15 | Esi int32 16 | Edi int32 17 | Ebp int32 18 | Eax int32 19 | Xds int32 20 | Xes int32 21 | Xfs int32 22 | Xgs int32 23 | Orig_eax int32 24 | Eip int32 25 | Xcs int32 26 | Eflags int32 27 | Esp int32 28 | Xss int32 29 | } 30 | 31 | // PtraceGetRegs386 fetches the registers used by 386 binaries. 32 | func PtraceGetRegs386(pid int, regsout *PtraceRegs386) error { 33 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 34 | } 35 | 36 | // PtraceSetRegs386 sets the registers used by 386 binaries. 37 | func PtraceSetRegs386(pid int, regs *PtraceRegs386) error { 38 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 39 | } 40 | 41 | // PtraceRegsAmd64 is the registers used by amd64 binaries. 42 | type PtraceRegsAmd64 struct { 43 | R15 uint64 44 | R14 uint64 45 | R13 uint64 46 | R12 uint64 47 | Rbp uint64 48 | Rbx uint64 49 | R11 uint64 50 | R10 uint64 51 | R9 uint64 52 | R8 uint64 53 | Rax uint64 54 | Rcx uint64 55 | Rdx uint64 56 | Rsi uint64 57 | Rdi uint64 58 | Orig_rax uint64 59 | Rip uint64 60 | Cs uint64 61 | Eflags uint64 62 | Rsp uint64 63 | Ss uint64 64 | Fs_base uint64 65 | Gs_base uint64 66 | Ds uint64 67 | Es uint64 68 | Fs uint64 69 | Gs uint64 70 | } 71 | 72 | // PtraceGetRegsAmd64 fetches the registers used by amd64 binaries. 73 | func PtraceGetRegsAmd64(pid int, regsout *PtraceRegsAmd64) error { 74 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 75 | } 76 | 77 | // PtraceSetRegsAmd64 sets the registers used by amd64 binaries. 78 | func PtraceSetRegsAmd64(pid int, regs *PtraceRegsAmd64) error { 79 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 80 | } 81 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptracearm_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(arm, arm64). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build arm arm64 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegsArm is the registers used by arm binaries. 11 | type PtraceRegsArm struct { 12 | Uregs [18]uint32 13 | } 14 | 15 | // PtraceGetRegsArm fetches the registers used by arm binaries. 16 | func PtraceGetRegsArm(pid int, regsout *PtraceRegsArm) error { 17 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 18 | } 19 | 20 | // PtraceSetRegsArm sets the registers used by arm binaries. 21 | func PtraceSetRegsArm(pid int, regs *PtraceRegsArm) error { 22 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 23 | } 24 | 25 | // PtraceRegsArm64 is the registers used by arm64 binaries. 26 | type PtraceRegsArm64 struct { 27 | Regs [31]uint64 28 | Sp uint64 29 | Pc uint64 30 | Pstate uint64 31 | } 32 | 33 | // PtraceGetRegsArm64 fetches the registers used by arm64 binaries. 34 | func PtraceGetRegsArm64(pid int, regsout *PtraceRegsArm64) error { 35 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 36 | } 37 | 38 | // PtraceSetRegsArm64 sets the registers used by arm64 binaries. 39 | func PtraceSetRegsArm64(pid int, regs *PtraceRegsArm64) error { 40 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 41 | } 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptracemips_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(mips, mips64). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build mips mips64 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegsMips is the registers used by mips binaries. 11 | type PtraceRegsMips struct { 12 | Regs [32]uint64 13 | Lo uint64 14 | Hi uint64 15 | Epc uint64 16 | Badvaddr uint64 17 | Status uint64 18 | Cause uint64 19 | } 20 | 21 | // PtraceGetRegsMips fetches the registers used by mips binaries. 22 | func PtraceGetRegsMips(pid int, regsout *PtraceRegsMips) error { 23 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 24 | } 25 | 26 | // PtraceSetRegsMips sets the registers used by mips binaries. 27 | func PtraceSetRegsMips(pid int, regs *PtraceRegsMips) error { 28 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 29 | } 30 | 31 | // PtraceRegsMips64 is the registers used by mips64 binaries. 32 | type PtraceRegsMips64 struct { 33 | Regs [32]uint64 34 | Lo uint64 35 | Hi uint64 36 | Epc uint64 37 | Badvaddr uint64 38 | Status uint64 39 | Cause uint64 40 | } 41 | 42 | // PtraceGetRegsMips64 fetches the registers used by mips64 binaries. 43 | func PtraceGetRegsMips64(pid int, regsout *PtraceRegsMips64) error { 44 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 45 | } 46 | 47 | // PtraceSetRegsMips64 sets the registers used by mips64 binaries. 48 | func PtraceSetRegsMips64(pid int, regs *PtraceRegsMips64) error { 49 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 50 | } 51 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptracemipsle_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(mipsle, mips64le). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build mipsle mips64le 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegsMipsle is the registers used by mipsle binaries. 11 | type PtraceRegsMipsle struct { 12 | Regs [32]uint64 13 | Lo uint64 14 | Hi uint64 15 | Epc uint64 16 | Badvaddr uint64 17 | Status uint64 18 | Cause uint64 19 | } 20 | 21 | // PtraceGetRegsMipsle fetches the registers used by mipsle binaries. 22 | func PtraceGetRegsMipsle(pid int, regsout *PtraceRegsMipsle) error { 23 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 24 | } 25 | 26 | // PtraceSetRegsMipsle sets the registers used by mipsle binaries. 27 | func PtraceSetRegsMipsle(pid int, regs *PtraceRegsMipsle) error { 28 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 29 | } 30 | 31 | // PtraceRegsMips64le is the registers used by mips64le binaries. 32 | type PtraceRegsMips64le struct { 33 | Regs [32]uint64 34 | Lo uint64 35 | Hi uint64 36 | Epc uint64 37 | Badvaddr uint64 38 | Status uint64 39 | Cause uint64 40 | } 41 | 42 | // PtraceGetRegsMips64le fetches the registers used by mips64le binaries. 43 | func PtraceGetRegsMips64le(pid int, regsout *PtraceRegsMips64le) error { 44 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 45 | } 46 | 47 | // PtraceSetRegsMips64le sets the registers used by mips64le binaries. 48 | func PtraceSetRegsMips64le(pid int, regs *PtraceRegsMips64le) error { 49 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 50 | } 51 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zsysnum_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | // TODO(aram): remove these before Go 1.3. 10 | const ( 11 | SYS_EXECVE = 59 12 | SYS_FCNTL = 62 13 | ) 14 | --------------------------------------------------------------------------------