code
stringlengths
10
1.34M
language
stringclasses
1 value
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package main import ( "fmt" "net" "time" "circuit/kit/tele" "circuit/kit/tele/blend" "circuit/kit/...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package teleport implements a command-line tool for utilizing teleport transport between legacy client...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package main import ( "net" "circuit/kit/tele/blend" "circuit/kit/tele/trace" ) type proxy struct { ...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package main import ( "flag" "log" "net" "os" ) var flagAddr = flag.String("addr", ":8787", "Address...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package tcp implements a carrier transport over TCP. package tcp import ( "net" "strings" "circuit...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package tcp type Addr string func (a Addr) String() string { return string(a) } func (a Addr) Network(...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package limiter schedules job execution while maintaining an upper limit on concurrency package limiter // TODO:...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package tele implements Teleport Transport which can overcome network outages without affecting endpoin...
Go
package pty import ( "errors" "os" "syscall" "unsafe" ) // see ioccom.h const sys_IOCPARM_MASK = 0x1fff func open() (pty, tty *os.File, err error) { p, err := os.OpenFile("/dev/ptmx", os.O_RDWR, 0) if err != nil { return nil, nil, err } sname, err := ptsname(p) if err != nil { return nil, nil, err } ...
Go
package pty import ( "os" "os/exec" "syscall" ) // Start assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout, // and c.Stderr, calls c.Start, and returns the File of the tty's // corresponding pty. func Start(c *exec.Cmd) (pty *os.File, err error) { pty, tty, err := Open() if err != nil { return nil, er...
Go
package pty import ( "os" "syscall" "unsafe" ) // Getsize returns the number of rows (lines) and cols (positions // in each line) in terminal t. func Getsize(t *os.File) (rows, cols int, err error) { var ws winsize err = windowrect(&ws, t.Fd()) return int(ws.ws_row), int(ws.ws_col), err } type winsize struct {...
Go
// Package pty provides functions for working with Unix terminals. package pty import ( "os" ) // Opens a pty and its corresponding tty. func Open() (pty, tty *os.File, err error) { return open() }
Go
package pty import ( "os" "strconv" "syscall" "unsafe" ) const ( sys_TIOCGPTN = 0x80045430 sys_TIOCSPTLCK = 0x40045431 ) func open() (pty, tty *os.File, err error) { p, err := os.OpenFile("/dev/ptmx", os.O_RDWR, 0) if err != nil { return nil, nil, err } sname, err := ptsname(p) if err != nil { retu...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package file import ( "os" "time" ) // FileInfo holds meta-information about a file. type FileInfo struct { Sav...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package file provides ways to pass open files to across circuit runtimes package file // XXX: Update this implem...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package exec facilitates remote execution of OS processes across workers package exec import ( "io" ...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package xy encloses utilities for exporting and importing high-level objects like file systems, sockets...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package io facilitates sharing io reader/writer/closers across workers. package io import ( "io" "ru...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package module provides a mechanism for linking an implementation package to a declaration package package module...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package fmt import ( "fmt" ) func FormatBytes(n uint64) string { switch { case n < 1e3: return fmt.Sprintf("%...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package fmt contains string formatting utilities package fmt import ( "bufio" "fmt" "io" "reflect" ) // Dee...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package xor import "hash/fnv" import "math/rand" func ChooseKey() Key { return Key(rand.Int63()) } // ChooseMinK...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package xor implements a nearest-neighbor data structure for the XOR-metric package xor import ( "errors" "fmt...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package sched import ( "io" "sync" ) // Quota behaves like sync.Mutex, except it allows up to a given ...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package sched contains primitives for scheduling package sched
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package limiter schedules job execution while maintaining an upper limit on concurrency package limiter // TODO:...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package kinfolk import ( "fmt" "circuit/kit/lang" "circuit/use/circuit" ) type XID struct { X circ...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package tube import ( "sync" ) // LossyRing type LossyRing struct { sync.Mutex head int tail int cy...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package tube import ( "bytes" "fmt" "sync" "time" "circuit/kit/kinfolk" "circuit/kit/lang" "circu...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package kinfolk import ( "math/rand" "sync" "circuit/use/circuit" ) type Rotor struct { sync.Mutex ...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package kinfolk import ( "sync" ) // type Folk struct { Topic string rtr *Rotor sync.Mutex ch cha...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package locus import ( "log" "time" "circuit/kit/kinfolk" "circuit/kit/kinfolk/tube" "circuit/kit/r...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package kinfolk ... package kinfolk import ( "bytes" "log" "sync" "circuit/kit/lang" "circuit/us...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Copyright 2010 Petar Maymounkov. All rights reserved. // Use of this source code is governed by a BSD-style // li...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Copyright 2010 Petar Maymounkov. All rights reserved. // Use of this source code is governed by a BSD-style // li...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Copyright 2010 Petar Maymounkov. All rights reserved. // Use of this source code is governed by a BSD-style // li...
Go
/* Copyright 2012 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software di...
Go
/* Copyright 2013 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software di...
Go
/* Copyright 2012 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software di...
Go
/* Copyright 2012 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software di...
Go
/* Copyright 2013 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software di...
Go
/* Copyright 2012 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software di...
Go
/* Copyright 2012 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software di...
Go
/* Copyright 2013 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software di...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package n import ( "net" ) const Scheme = "circuit" // Addr represents the identity of a unique remote worker. /...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package n import ( "circuit/kit/module" "net" ) var mod = module.Slot{Name: "network"} func Bind(v Sy...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package n import ( "fmt" "hash/fnv" "math/rand" "strconv" "circuit/use/e" ) var ErrParse = e.NewError("parse...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package e import ( "encoding/gob" "errors" "fmt" "runtime" ) func init() { gob.Register(&Error{}) gob.Regist...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package durablefs exposes the programming interface to a global file system for storing cross-values package dura...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package use contains the programming interfaces exposed by the circuit module system package use
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package circuit import ( "circuit/use/n" "circuit/use/worker" ) type runtime interface { // Low-level WorkerAd...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package circuit import ( "fmt" "math/rand" "circuit/use/n" ) // HandleID is a universal ID referring to a circ...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package circuit exposes the core functionalities provided by the circuit programming environment package circuit ...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package worker is a facade for the circuit spawning mechanism module package worker import ( "circuit/kit/modul...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package anchorfs exposes the programming interface for accessing the anchor file system package anchorfs import ...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package anchorfs import ( "circuit/kit/module" ) var mod = module.Slot{Name: "anchor file system"} // Bind is us...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // fd is a command-line utility that opens a file for reading/writing and redirects its I/O to the standar...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // This package provides the executable program for the resource-sharing circuit app package main import ...
Go
// Copyright 2013 The Go Circuit Project // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> package main import ( "fmt" "log" "math/rand" "net" "os" "path" "path/filepath" "strings" "time"...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package cmd encloses command-line executables package doc
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package test contains end-to-end circuit test cases package test
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package main is the main executable for starting the circuit application package main import ( _ "circuit/kit/d...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package worker defines the worker function for this application package worker import ( "circuit/use/circuit" )...
Go
// Copyright 2013 Tumblr, Inc. // Use of this source code is governed by the license for // The Go Circuit Project, found in the LICENSE file. // // Authors: // 2013 Petar Maymounkov <p@gocircuit.org> // Package xgc implements a circuit application for testing cross-runtime garbage collection package xgc
Go
// Copyright 2013 Tumblr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
Go
// Copyright 2013 Tumblr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
Go
// Copyright 2013 Tumblr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
Go
// Copyright 2013 Tumblr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
Go
// Copyright 2013 Tumblr, Inc. // Copyright 2013 Petar Maymounkov // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless require...
Go
// Copyright 2013 Tumblr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
Go
// Copyright 2013 Tumblr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
Go
package front import ( "bufio" "circuit/kit/sched/limiter" "errors" "fmt" "io" "net" "strconv" "strings" "vena" "vena/server" ) type Replier interface { Put(vena.Time, string, map[string]string, float64) Query(string, vena.Time, vena.Time, map[string]string) server.Series Dump() interface{} DieDieDie() ...
Go
// Copyright 2013 Tumblr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
Go
// Copyright 2013 Tumblr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
Go
// Copyright 2013 Tumblr, Inc. // Copyright 2013 Petar Maymounkov // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless require...
Go
// Copyright 2013 Tumblr, Inc. // Copyright 2013 Petar Maymounkov // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless require...
Go
package levigo // // #cgo LDFLAGS: -lleveldb (comment out in favor of static linking thru CGO_LDFLAGS) // #include <stdlib.h> // #include "leveldb/c.h" import "C" import ( "unsafe" ) type IteratorError string func (e IteratorError) Error() string { return string(e) } // Iterator is a read-only iterator through a...
Go
package levigo // // #cgo LDFLAGS: -lleveldb (comment out in favor of static linking thru CGO_LDFLAGS) // #include <stdlib.h> // #include "leveldb/c.h" import "C" // FilterPolicy is a factory type that allows the LevelDB database to create a // filter, such as a bloom filter, that is stored in the sstables and used b...
Go
package levigo // // #cgo LDFLAGS: -lleveldb (comment out in favor of static linking thru CGO_LDFLAGS) // #include "leveldb/c.h" import "C" // DestroyComparator deallocates a *C.leveldb_comparator_t. // // This is provided as a convienience to advanced users that have implemented // their own comparators in C in thei...
Go
package levigo /* // #cgo LDFLAGS: -lleveldb (comment out in favor of static linking thru CGO_LDFLAGS) #include <stdlib.h> #include "leveldb/c.h" // This function exists only to clean up lack-of-const warnings when // leveldb_approximate_sizes is called from Go-land. void levigo_leveldb_approximate_sizes( leveldb...
Go
package levigo // // #cgo LDFLAGS: -lleveldb (comment out in favor of static linking thru CGO_LDFLAGS) // #include "leveldb/c.h" import "C" // Env is a system call environment used by a database. // // Typically, NewDefaultEnv is all you need. Advanced users may create their // own Env with a *C.leveldb_env_t of thei...
Go
package levigo // // #cgo LDFLAGS: -lleveldb (comment out in favor of static linking thru CGO_LDFLAGS) // #include <stdint.h> // #include "leveldb/c.h" import "C" // Cache is a cache used to store data read from data in memory. // // Typically, NewLRUCache is all you will need, but advanced users may // implement the...
Go
package levigo // // #cgo LDFLAGS: -lleveldb (comment out in favor of static linking thru CGO_LDFLAGS) // #include "leveldb/c.h" import "C" // CompressionOpt is a value for Options.SetCompression. type CompressionOpt int // Known compression arguments for Options.SetCompression. const ( NoCompression = Compress...
Go
package levigo // #include "leveldb/c.h" import "C" func boolToUchar(b bool) C.uchar { uc := C.uchar(0) if b { uc = C.uchar(1) } return uc } func ucharToBool(uc C.uchar) bool { if uc == C.uchar(0) { return false } return true }
Go
package levigo // // #cgo LDFLAGS: -lleveldb (comment out in favor of static linking thru CGO_LDFLAGS) // #include "leveldb/c.h" import "C" import ( "unsafe" ) // WriteBatch is a batching of Puts, and Deletes to be written atomically to a // database. A WriteBatch is written when passed to DB.Write. // // To preven...
Go
package main /* // has_cgo LDFLAGS: -lleveldb #include <string.h> #include <leveldb/c.h> static void CmpDestroy(void* arg) { } static int CmpCompare(void* arg, const char* a, size_t alen, const char* b, size_t blen) { int n = (alen < blen) ? alen : blen; int r = memcmp(a, b, n); if (r == ...
Go
/* Package levigo provides the ability to create and access LevelDB databases. levigo.Open opens and creates databases. opts := levigo.NewOptions() opts.SetCache(levigo.NewLRUCache(3<<30)) opts.SetCreateIfMissing(true) db, err := levigo.Open("/path/to/db", opts) The DB struct returned by Open provides DB.Get, D...
Go
package vena import ( "circuit/kit/xor" "path" ) type Config struct { Anchor string // Root anchor for the shards Meta *MetaConfig Shard []*ShardConfig } type ShardConfig struct { Key xor.Key Host string Dir string Cache int } type MetaConfig struct { Anchor string Host string Dir string C...
Go
// Copyright 2013 Tumblr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
Go
// Copyright 2013 Tumblr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
Go
// Copyright 2013 Tumblr, Inc. // Copyright 2013 Petar Maymounkov // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless require...
Go
// Copyright 2013 Tumblr, Inc. // Copyright 2013 Petar Maymounkov // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless require...
Go
// Copyright 2013 Petar Maymounkov // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed t...
Go
// Copyright 2013 Tumblr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
Go
// Copyright 2013 Tumblr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
Go
// Copyright 2013 Tumblr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
Go
// Copyright 2013 Tumblr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
Go
// Copyright 2013 Tumblr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
Go
// Copyright 2013 Tumblr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
Go
// Copyright 2013 Tumblr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
Go