code stringlengths 10 1.34M | language stringclasses 1
value |
|---|---|
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This code is a duplicate of syscall/syscall_linux_386.go with small
// modifications.
package ipv6
import (
"syscall"
"unsafe"
)
// On x86 Linux, all th... | Go |
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package ipv6 implements IP-level socket options for the Internet
// Protocol version 6.
//
// The package provides IP-level socket options that allow
// man... | Go |
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ipv6
import "syscall"
func ipv6ReceiveTrafficClass(fd syscall.Handle) (bool, error) {
// TODO(mikio): Implement this
return false, syscall.EWINDOWS... | Go |
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ipv6
import (
"net"
"syscall"
)
// RFC 3493 options
const (
// See ws2tcpip.h.
sysSockoptUnicastHopLimit = syscall.IPV6_UNICAST_HOPS
sysSocko... | Go |
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build nacl plan9 solaris
package ipv6
func (c *genericOpt) sysfd() (int, error) {
// TODO(mikio): Implement this
return 0, errOpNoSupport
}
func (c *d... | Go |
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build go1.1,!go1.2
package ipv6
import "syscall"
func socketcallnosplit7(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno)
func init() {
... | Go |
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin dragonfly freebsd netbsd openbsd
package ipv6
type sysICMPFilter struct {
Filt [8]uint32
}
func (f *sysICMPFilter) set(typ ICMPType, block... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package spdy
import (
"compress/zlib"
"encoding/binary"
"io"
"net/http"
"strings"
)
func (frame *SynStreamFrame) read(h ControlFrameHeader, f *Framer) er... | Go |
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package spdy
// headerDictionary is the dictionary sent to the zlib compressor/decompressor.
var headerDictionary = []byte{
0x00, 0x00, 0x00, 0x07, 0x6f, 0x70... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package spdy
import (
"encoding/binary"
"io"
"net/http"
"strings"
)
func (frame *SynStreamFrame) write(f *Framer) error {
return f.writeSynStreamFrame(fr... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package spdy implements the SPDY protocol (currently SPDY/3), described in
// http://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3.
package spdy
... | Go |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package websocket
// This file implements a protocol of Hixie draft version 75 and 76
// (draft 76 equals to hybi 00)
import (
"bufio"
"bytes"
"crypto/md5"... | Go |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package websocket implements a client and server for the WebSocket protocol
// as specified in RFC 6455.
package websocket
import (
"bufio"
"crypto/tls"
... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package websocket
// This file implements a protocol of hybi draft.
// http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-17
import (
"bufio"
"... | Go |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package websocket
import (
"bufio"
"fmt"
"io"
"net/http"
)
func newServerConn(rwc io.ReadWriteCloser, buf *bufio.ReadWriter, req *http.Request, config *Co... | Go |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package websocket
import (
"bufio"
"crypto/tls"
"io"
"net"
"net/http"
"net/url"
)
// DialError is an error that occurs while dialling a websocket server... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package idna
// This file implements the Punycode algorithm from RFC 3492.
import (
"fmt"
"math"
"strings"
"unicode/utf8"
)
// These parameter values are... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package idna implements IDNA2008 (Internationalized Domain Names for
// Applications), defined in RFC 5890, RFC 5891, RFC 5892, RFC 5893 and
// RFC 5894.
pac... | Go |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package dict implements the Dictionary Server Protocol
// as defined in RFC 2229.
package dict
import (
"net/textproto"
"strconv"
"strings"
)
// A Clie... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ipv4
import (
"syscall"
)
func ipv4HeaderPrepend(fd int) (bool, error) {
// TODO(mikio): Implement this
return false, syscall.EPLAN9
}
func setIP... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ipv4
import (
"errors"
"fmt"
"net"
"runtime"
"syscall"
"unsafe"
)
var (
errMissingAddress = errors.New("missing address")
errMissingHeader ... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ipv4
import (
"syscall"
)
func (c *genericOpt) sysfd() (int, error) {
// TODO(mikio): Implement this
return 0, syscall.EPLAN9
}
func (c *dgramOpt... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin freebsd linux netbsd openbsd windows
package ipv4
import (
"net"
"syscall"
)
// MulticastTTL returns the time-to-live field value for out... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ipv4
import (
"errors"
"net"
)
var (
errNoSuchInterface = errors.New("no such interface")
errNoSuchMulticastInterface = errors.New("no s... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ipv4
import (
"net"
"syscall"
"time"
)
// A Conn represents a network endpoint that uses the IPv4 transport.
// It is used to control basic IP-lev... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ipv4
import (
"net"
"os"
"syscall"
"unsafe"
)
// Linux provides a convenient path control option IP_PKTINFO that
// contains IP_SENDSRCADDR, IP_R... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ipv4
import (
"net"
"syscall"
)
func (c *dgramOpt) MulticastTTL() (int, error) {
// TODO(mikio): Implement this
return 0, syscall.EPLAN9
}
func ... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ipv4
import (
"syscall"
)
func setControlMessage(fd int, opt *rawOpt, cf ControlFlags, on bool) error {
// TODO(mikio): Implement this
return sysc... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin freebsd linux netbsd openbsd windows
package ipv4
import (
"bytes"
"net"
"syscall"
)
func setSyscallIPMreq(mreq *syscall.IPMreq, ifi *ne... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ipv4
import (
"net"
"os"
"syscall"
)
func ipv4ReceiveTOS(fd int) (bool, error) {
v, err := syscall.GetsockoptInt(fd, syscall.IPPROTO_IP, syscall.... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin freebsd linux netbsd openbsd
package ipv4
import (
"os"
"syscall"
)
func ipv4TOS(fd int) (int, error) {
v, err := syscall.GetsockoptInt(... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ipv4
import (
"fmt"
"net"
"sync"
)
type rawOpt struct {
mu sync.Mutex
cflags ControlFlags
}
func (o *rawOpt) lock() { o... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin freebsd netbsd openbsd
package ipv4
import (
"net"
"os"
"syscall"
)
func ipv4MulticastTTL(fd int) (int, error) {
v, err := syscall.Gets... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin freebsd linux netbsd openbsd
package ipv4
import (
"net"
"reflect"
)
func (c *genericOpt) sysfd() (int, error) {
switch p := c.c.(type) ... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin freebsd netbsd openbsd
package ipv4
import (
"net"
"os"
"syscall"
"unsafe"
)
func setControlMessage(fd int, opt *rawOpt, cf ControlFlag... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ipv4
import (
"net"
"reflect"
"syscall"
)
func (c *genericOpt) sysfd() (syscall.Handle, error) {
switch p := c.c.(type) {
case *net.TCPConn, *ne... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ipv4
import (
"net"
"syscall"
)
// A payloadHandler represents the IPv4 datagram payload handler.
type payloadHandler struct {
c net.PacketConn
r... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ipv4
import (
"net"
"syscall"
)
// A packetHandler represents the IPv4 datagram handler.
type packetHandler struct {
c *net.IPConn
rawOpt
}
func... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ipv4
import (
"os"
"syscall"
)
func ipv4SendSourceAddress(fd int) (bool, error) {
v, err := syscall.GetsockoptInt(fd, syscall.IPPROTO_IP, syscall.... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ipv4
import (
"syscall"
)
func setControlMessage(fd syscall.Handle, opt *rawOpt, cf ControlFlags, on bool) error {
// TODO(mikio): Implement this
... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package ipv4 implements IP-level socket options for the Internet
// Protocol version 4.
//
// The package provides IP-level socket options that allow
// man... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin freebsd linux netbsd openbsd windows
package ipv4
import (
"syscall"
)
// TOS returns the type-of-service field value for outgoing packets... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ipv4
import (
"syscall"
)
func (c *genericOpt) TOS() (int, error) {
// TODO(mikio): Implement this
return 0, syscall.EPLAN9
}
func (c *genericOpt... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ipv4
import (
"net"
"os"
"syscall"
"unsafe"
)
// Please refer to the online manual;
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package proxy
import (
"errors"
"io"
"net"
"strconv"
)
// SOCKS5 returns a Dialer that makes SOCKSv5 connections to the given address
// with an optional ... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package proxy provides support for a variety of protocols to proxy network
// data.
package proxy
import (
"errors"
"net"
"net/url"
"os"
)
// A Dialer ... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package proxy
import (
"net"
)
type direct struct{}
// Direct is a direct proxy: one that makes network connections directly.
var Direct = direct{}
func (d... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package proxy
import (
"net"
"strings"
)
// A PerHost directs connections to a default Dialer unless the hostname
// requested matches one of a number of ex... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
package main
// This program generates table.go and table_test.go.
// Invoke as:
//
// go run gen.go -version "xxx" >table.go
// go run... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package publicsuffix provides a public suffix list based on data from
// http://publicsuffix.org/. A public suffix is one under which Internet users
// can d... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package html
import (
"code.google.com/p/go.net/html/atom"
)
// A NodeType is the type of a Node.
type NodeType uint32
const (
ErrorNode NodeType = iota
T... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package html
import (
"strings"
)
func adjustAttributeNames(aa []Attribute, nameMap map[string]string) {
for i := range aa {
if newName, ok := nameMap[aa[... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package html
import (
"bufio"
"errors"
"fmt"
"io"
"strings"
)
type writer interface {
io.Writer
WriteByte(c byte) error // in Go 1.1, use io.ByteWriter... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package html
// Section 12.2.3.2 of the HTML5 specification says "The following elements
// have varying levels of special parsing rules".
// http://www.whatwg... | Go |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package html
import (
"bytes"
"io"
"strconv"
"strings"
"code.google.com/p/go.net/html/atom"
)
// A TokenType is the type of a Token.
type TokenType uint... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package html
import (
"strings"
)
// parseDoctype parses the data from a DoctypeToken into a name,
// public identifier, and system identifier. It returns a ... | Go |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package html
import (
"bytes"
"strings"
"unicode/utf8"
)
// These replacements permit compatibility with old numeric entities that
// assumed Windows-1252 ... | Go |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package html
import (
"errors"
"fmt"
"io"
"strings"
a "code.google.com/p/go.net/html/atom"
)
// A parser implements the HTML5 parsing algorithm:
// http... | Go |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package html
// All entities that do not end with ';' are 6 or fewer bytes long.
const longestEntityWithoutSemicolon = 6
// entity is a map from HTML entity n... | Go |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
Package html implements an HTML5-compliant tokenizer and parser.
Tokenization is done by creating a Tokenizer for an io.Reader r. It is the
caller's respons... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package atom provides integer codes (also known as atoms) for a fixed set of
// frequently occurring HTML strings: tag names and attribute keys such as "p"
/... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
package main
// This program generates table.go and table_test.go.
// Invoke as
//
// go run gen.go |gofmt >table.go
// go run gen.go -test |... | Go |
package main
import (
"encoding/json"
"errors"
"flag"
"fmt"
"io/ioutil"
"log"
"net"
"net/http"
"os"
"os/exec"
"path"
"runtime"
"code.google.com/p/goauth2/oauth"
"code.google.com/p/google-api-go-client/youtube/v3"
)
var (
clientSecretsFile = flag.String("secrets", "client_secrets.json", "Client Secrets... | Go |
//
// An example of encoding/decoding object
//
package main
import "encoding/gob"
import "fmt"
import "os"
type Op struct {
X int
Y int
}
func writeOp() {
op := Op{10, 10}
fo, _ := os.Create("a.bin")
defer fo.Close()
enc := gob.NewEncoder(fo)
enc.Encode(op)
}
func readOp() {
fi... | Go |
package atomutil
import "encoding/gob"
import "os"
import "path/filepath"
import "strings"
import "strconv"
import "crypto/rand"
import "math/big"
import "fmt"
const (
DEBUG = true
)
//
// used to generate a UID for an operation
//
func nrand() int64 {
max := big.NewInt(int64(1) << 62)
bigx, _ := rand.... | Go |
package paxos
//
// Paxos library, to be included in an application.
// Multiple applications will run, each including
// a Paxos peer.
//
// Manages a sequence of agreed-on values.
// The set of peers is fixed.
// Copes with network failures (partition, msg loss, &c).
// Does not store anything persistently, so canno... | Go |
package main
import "fmt"
import "flag"
import "demoutil"
import "os"
import "strconv"
import "bufio"
//import "math/rand"
// Distributed System
import "shardkv"
//go run demo_server_kv.go
var DoTcp = flag.Bool("tcp", false, "communicate across tcp")
var DoAuto = flag.Bool("auto", true, "load hardcoded settings")
... | Go |
package main
import "fmt"
import "flag"
import "demoutil"
import "os"
import "strconv"
import "bufio"
//import "math/rand"
// Distributed System
import "shardkv"
//go run demo_server_kv.go
var DoTcp = flag.Bool("tcp", false, "communicate across tcp")
var DoAuto = flag.Bool("auto", true, "load hardcoded settings")
... | Go |
package main
import "fmt"
import "flag"
import "demoutil"
import "os"
import "strconv"
import "strings"
import "bufio"
// Distributed System
import "shardmaster"
//go run demo_server_sm.go
var DoTcp = flag.Bool("tcp", false, "communicate across tcp")
var DoAuto = flag.Bool("auto", true, "load hardcoded settings")
... | Go |
//
// An example of encoding/decoding object
//
package main
import "encoding/gob"
import "fmt"
import "os"
import "atomutil"
type Op struct {
X int
Y int
}
type PaxosState struct {
Np int
Na int
Va interface{}
Decided bool
DecidedV interface{}
InsId int // instance id
}
func speedtest() {
f... | Go |
package util
import "log"
import "fmt"
import "os"
type Logger struct {
Logger *log.Logger
logname string
log_stdout bool
}
func NewLogger(name string, to_stdout bool) *Logger {
kv := new(Logger)
kv.log_stdout = to_stdout
var fout *os.File
if !kv.log_stdout {
kv.logname = name + ".log"
var err error
... | Go |
package shardmaster
//
// Master shard server: assigns shards to replication groups.
//
// RPC interface:
// Join(gid, servers) -- replica group gid is joining, give it some shards.
// Leave(gid) -- replica group gid is retiring, hand off all its shards.
// Move(shard, gid) -- hand off one shard from current owner to ... | Go |
package shardmaster
import "net"
import "fmt"
import "net/rpc"
import "paxos"
import "sync"
import "os"
import "syscall"
import "encoding/gob"
import "math/rand"
import cryptoRand "crypto/rand"
import "math/big"
import "time"
//import "strings"
import "util"
type ShardMaster struct {
mu sync.Mutex
l ... | Go |
package shardmaster
//
// Shardmaster clerk.
// Please don't change this file.
//
import "net/rpc"
import "time"
//import "fmt"
import "strings"
type Clerk struct {
servers []string // shardmaster replicas
}
// modify client's server parser
func GetConn(ports []string) []string {
DoTcp := strings.Contains(ports... | Go |
package demoutil
import "fmt"
import "strings"
// 1. Console I/O
type CMD struct {
alive bool
me_type string
todo []string
}
func (cmd *CMD) GetTodo() []string {
return cmd.todo
}
func (cmd *CMD) GetStatus() bool {
return cmd.alive
}
func (cmd *CMD) ParseInput(input string) bool {
//fmt.Printf("cmd: %... | Go |
package demoutil
import "fmt"
import "strconv"
import "strings"
import "os"
import "net"
// for paxos: persistence on disk
func Port(tag string, host int, DoTcp bool) string {
// in order to be consitent with most code
// we continue to have one return argument
s_ip := ""
if DoTcp {
// local network
//s_ip = ... | Go |
package main
import "flag"
//import "strings"
import "log"
import "time"
import "demoutil"
//import "fmt"
// Distributed System
import "shardkv"
//go build shardkv_server.go
//./shardkv_server -port=9001 -peers=machine2:9001,machine3:9001
// using tcp for simplicity
var Port = flag.String("port", "0", "port numbe... | Go |
package main
import "fmt"
import "flag"
import "demoutil"
import "os"
import "strconv"
import "bufio"
import "io"
//import "strings"
//import "math/rand"
// Distributed System
import "shardmaster"
var f_smh = flag.String("masters", "", "port number")
var f_auto = flag.String("file", "", "port number")
var mck *shar... | Go |
package main
import "fmt"
import "flag"
import "demoutil"
import "os"
import "strconv"
import "bufio"
import "io"
import "sort"
import "strings"
import "io/ioutil"
//import "math/rand"
// Distributed System
import "shardkv"
var ck *shardkv.Clerk
var f_login = flag.String("login", "anonymous", "log in name")
var f_... | Go |
package main
import "flag"
//import "strings"
import "log"
//import "fmt"
import "time"
import "demoutil"
// Distributed System
import "shardmaster"
//go build shardmaster_server.go
//./shardmaster_server -port=9001 -peers=machine2:9001,machine3:9001
// using tcp for simplicity
var Port = flag.String("port", "0", ... | Go |
package shardkv
//
// Sharded key/value server.
// Lots of replica groups, each running op-at-a-time paxos.
// Shardmaster decides which group serves each shard.
// Shardmaster may change shard assignment from time to time.
//
// You will have to modify these definitions.
//
const (
OK = "OK"
ErrNoKey = "ErrNoKey... | Go |
package shardkv
import "sync"
import "shardmaster"
type Clerk2 struct {
mu sync.Mutex // one RPC at a time
sm *shardmaster.Clerk
config shardmaster.Config
// You'll have to modify Clerk.
}
func MakeClerk2(shardmasters []string) *Clerk2 {
ck := new(Clerk2)
ck.sm = shardmaster.MakeClerk(shardmasters)
//... | Go |
package shardkv
import "net"
import "fmt"
import "net/rpc"
import "time"
import "paxos"
import "sync"
import "os"
import "syscall"
import "encoding/gob"
import "math/rand"
import "shardmaster"
import "strconv"
import "strings"
import "util"
const (
GET = "GET"
PUT = "PUT"
START_RECONFIG = "ST... | Go |
package shardkv
import "shardmaster"
import "net/rpc"
import "time"
import "sync"
import "fmt"
import "crypto/rand"
import "math/big"
import "os"
import "strings"
type Clerk struct {
mu sync.Mutex // one RPC at a time
sm *shardmaster.Clerk
config shardmaster.Config
// You'll have to modify Clerk.
}
func ... | Go |
package main
import "flag"
import "fmt"
import "strings"
import "shardmaster"
import "time"
var g_ip = flag.Int("port", 9000, "port to listen to")
var g_peers = flag.String("peers", "", "peers' ports (excluding self)")
func main() {
flag.Parse()
peers := strings.Split(*g_peers, ",")
peers = filter(peers, not_ws)
... | Go |
package main
import "flag"
import "fmt"
import "strings"
import "shardmaster"
import "bufio"
import "os"
import "strconv"
var g_masters = flag.String("masters", "", "addresses of the master servers")
func main() {
flag.Parse()
masters := strings.Split(*g_masters, ",")
ck := shardmaster.MakeClerk(masters)
in := b... | Go |
// Copyright 2011 Gorilla Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package sessions
import (
"fmt"
"http"
"os"
"time"
"appengine"
"appengine/datastore"
"appengine/memcache"
"gorilla.googlecode.com/hg/gorilla/sessions"... | Go |
// Copyright 2011 Gorilla Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
Package gorilla/appengine/sessions implements session stores for Google App
Engine's datastore and memcache.
Usage is the same as described in gorilla/sess... | Go |
// Copyright 2011 Gorilla Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package sessions
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/hmac"
"crypto/rand"
"crypto/subtle"
"encoding/base64"
"fmt"
"gob"
"hash"
"ht... | Go |
// Copyright 2011 Gorilla Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
Package gorilla/sessions provides cookie sessions and infrastructure for
custom session back-ends.
The key features are:
* Dead simple basic API: use it a... | Go |
// Copyright 2011 Gorilla Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package context
import (
"http"
"sync"
)
// DefaultContext is the default context instance.
var DefaultContext = new(Context)
// Maps request -> namespace... | Go |
// Copyright 2011 Gorilla Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
Package gorilla/context provides utilities to manage request contexts.
A context stores global values for HTTP requests in a thread-safe manner.
The origin... | Go |
package dragon
import (
"http"
"os"
"time"
"strconv"
"fmt"
"gorilla.googlecode.com/hg/gorilla/sessions"
"github.com/russross/blackfriday"
"appengine"
"appengine/datastore"
)
func check(err os.Error, w http.ResponseWriter) {
if err != nil {
http.Error(w, err.String(), http.StatusInternalServerErro... | Go |
package dragon
import (
"fmt"
"http"
"json"
"template"
"os"
"strconv"
"math"
"appengine"
"appengine/urlfetch"
)
const albumsFeed = `http://picasaweb.google.com/data/feed/api/user/%s?alt=%s&v=%s&fields=%s&max-results=%d&start-index=%d`
const albumscountFeed = `http://picasaweb.google.com/data/feed/api/user/%... | Go |
package dragon
import (
"fmt"
"http"
"json"
"template"
"appengine"
"appengine/urlfetch"
)
const moviesFeed = `http://gdata.youtube.com/feeds/api/users/%s/uploads?alt=%s&v=%s&thumbsize=%s`
type movie struct {
Title string
Id string
Thumb string
}
func handleMovies(w http.ResponseWriter, r *http.Request) {
... | Go |
package dragon
import (
"fmt"
"http"
"json"
"template"
"strconv"
"appengine"
"appengine/urlfetch"
)
const photosFeed = `http://picasaweb.google.com/data/feed/api/user/%s/albumid/%s?alt=%s&v=%s&thumbsize=%s&imgmax=%s&fields=%s`
type photo struct {
Id string
Thumb string
Img string
Width string
Height str... | Go |
package dragon
import (
"http"
"template"
)
func handleCalendar(w http.ResponseWriter, r *http.Request) {
ts := new(template.Set)
troot, _ := template.New("root").
ParseFile("templates/root.html")
tarticleshow, _ := template.New("content").
ParseFile("templates/calendar.html")
ts.Add(troot, tarticleshow)
t... | Go |
package dragon
/*
import (
"bytes"
"http"
"image"
"image/jpeg"
"template"
"time"
"appengine"
"appengine/datastore"
)
type person struct {
Fname string
Lname string
Function string
Group string
Date datastore.Time
}
func handleSquad(w http.ResponseWriter, r *http.Requ... | Go |
package dragon
import (
"http"
"template"
"appengine"
)
func handleDocuments(w http.ResponseWriter, r *http.Request) {
c := appengine.NewContext(r)
ts := new(template.Set)
troot, _ := template.New("root").
Funcs(template.FuncMap{
"date": stuffDate,
}).
ParseFile("templates/root.html")
tcontent, _ := ... | Go |
package dragon
import (
"http"
appengineSessions "gorilla.googlecode.com/hg/gorilla/appengine/sessions"
"gorilla.googlecode.com/hg/gorilla/sessions"
)
const user = "115396442595599374875"
const ytuser = "7dhdragon"
const method = "json"
const apiver = "2"
const thumbsize = "180u"
const imgmax = "800u"
const albu... | Go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.