<commit_before>package main

import (
	"github.com/gorilla/mux"
	"log"
	"net/http"
)

func main() {
	router := mux.NewRouter()

	s := router.Path("/{user}/{repo}/objects/{oid}").Subrouter()

	s.Methods("PUT").HandlerFunc(PutHandler)
	s.Methods("GET").HandlerFunc(GetHandler)

	log.Fatal(http.ListenAndServe(":8083", router))
}

func PutHandler(w http.ResponseWriter, r *http.Request) {
}

func GetHandler(w http.ResponseWriter, r *http.Request) {
}<commit_msg>start sketching out handlers<commit_after>package main

import (
	"encoding/json"
	"github.com/gorilla/mux"
	"log"
	"net/http"
	"path/filepath"
)

func main() {
	router := mux.NewRouter()

	s := router.Path("/{user}/{repo}/objects/{oid}").Subrouter()

	s.Methods("GET").Headers("Accept", "application/vnd.git-media").HandlerFunc(GetHandler)
	s.Methods("GET").Headers("Accept", "application/vnd.git-media+json").HandlerFunc(GetUploadHandler)

	log.Fatal(http.ListenAndServe(":8083", router))
}

func GetHandler(w http.ResponseWriter, r *http.Request) {

}

func GetUploadHandler(w http.ResponseWriter, r *http.Request) {
	vars := mux.Vars(r)
	oid := vars["oid"]
	path := oidPath(oid)
	token := S3NewToken("PUT", path, oid)

	m := make(map[string]map[string]string)
	header := make(map[string]string)
	header["Date"] = token.Time.Format(http.TimeFormat)
	header["Authorization"] = token.Token
	header["x-amz-content-sha256"] = oid
	m["header"] = header

	links := make(map[string]string)
	links["upload"] = token.Location
	links["callback"] = "http://somecallback.com"
	m["_links"] = links

	enc := json.NewEncoder(w)
	enc.Encode(m)
}

func oidPath(oid string) string {
	dir := filepath.Join(oid[0:2], oid[2:4])

	return filepath.Join("/", dir, oid)
}
{'fraction_non_alphanumeric': 0.19133996489174956, 'fraction_numerical': 0.009362200117027502, 'mean_word_length': 5.452830188679245, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6279410', 'n_tokens_mistral': 651, 'n_tokens_neox': 630, 'n_words': 103}