<commit_before>// Go binding for nanomsg

package reqrep

// #include <nanomsg/reqrep.h>
import "C"

import (
	"time"

	"github.com/op/go-nanomsg"
)

type ReqSocket struct {
	*nanomsg.Socket
}

// NewReqSocket creates a request socket used to implement the client
// application that sends requests and receives replies.
func NewReqSocket() (*ReqSocket, error) {
	socket, err := nanomsg.NewSocket(nanomsg.SP, C.NN_REQ)
	return &ReqSocket{socket}, err
}

// ResendIvl returns the resend interval. If reply is not received in specified
// amount of time, the request will be automatically resent. Default value is 1
// minute.
func (req *ReqSocket) ResendIvl() (time.Duration, error) {
	ivl, err := req.Socket.GetSockOptInt(C.NN_REQ, C.NN_REQ_RESEND_IVL)
	return time.Duration(ivl) * time.Millisecond, err
}

// SetResendIvl sets the resend interval for requests.
func (req *ReqSocket) SetResendIvl(ivl time.Duration) error {
	ivlMs := int(linger / time.Millisecond)
	return s.SetSockOptInt(C.NN_REQ, C.NN_REQ_RESEND_IVL, lingerMs)
}

type RepSocket struct {
	*nanomsg.Socket
}

// NewRepSocket creates a reply socket used to implement the stateless worker
// that receives requests and sends replies.
func NewRepSocket() (*RepSocket, error) {
	socket, err := nanomsg.NewSocket(nanomsg.SP, C.NN_REP)
	return &RepSocket{socket}, err
}
<commit_msg>Fixed copy paste bug<commit_after>// Go binding for nanomsg

package reqrep

// #include <nanomsg/reqrep.h>
import "C"

import (
	"time"

	"github.com/op/go-nanomsg"
)

type ReqSocket struct {
	*nanomsg.Socket
}

// NewReqSocket creates a request socket used to implement the client
// application that sends requests and receives replies.
func NewReqSocket() (*ReqSocket, error) {
	socket, err := nanomsg.NewSocket(nanomsg.SP, C.NN_REQ)
	return &ReqSocket{socket}, err
}

// ResendIvl returns the resend interval. If reply is not received in specified
// amount of time, the request will be automatically resent. Default value is 1
// minute.
func (req *ReqSocket) ResendIvl() (time.Duration, error) {
	ivl, err := req.Socket.GetSockOptInt(C.NN_REQ, C.NN_REQ_RESEND_IVL)
	return time.Duration(ivl) * time.Millisecond, err
}

// SetResendIvl sets the resend interval for requests.
func (req *ReqSocket) SetResendIvl(ivl time.Duration) error {
	ivlMs := int(ivl / time.Millisecond)
	return req.Socket.SetSockOptInt(C.NN_REQ, C.NN_REQ_RESEND_IVL, ivlMs)
}

type RepSocket struct {
	*nanomsg.Socket
}

// NewRepSocket creates a reply socket used to implement the stateless worker
// that receives requests and sends replies.
func NewRepSocket() (*RepSocket, error) {
	socket, err := nanomsg.NewSocket(nanomsg.SP, C.NN_REP)
	return &RepSocket{socket}, err
}

{'fraction_non_alphanumeric': 0.1078576723498888, 'fraction_numerical': 0.0007412898443291327, 'mean_word_length': 4.519427402862986, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1951074', 'n_tokens_mistral': 932, 'n_tokens_neox': 917, 'n_words': 279}