<commit_before>package session

import (
	"strconv"

	"github.com/boltdb/bolt"
	"github.com/cenkalti/rain/internal/torrent"
	"github.com/nictuku/dht"
)

type Torrent struct {
	id           uint64
	port         uint16
	dhtAnnouncer *dhtAnnouncer
	session      *Session
	torrent      *torrent.Torrent
	removed      chan struct{}
}

func (t *Torrent) ID() uint64 {
	return t.id
}

func (t *Torrent) Name() string {
	return t.torrent.Name()
}

func (t *Torrent) InfoHash() string {
	return t.torrent.InfoHash()
}

func (t *Torrent) Stats() torrent.Stats {
	return t.torrent.Stats()
}

func (t *Torrent) Trackers() []torrent.Tracker {
	return t.torrent.Trackers()
}

func (t *Torrent) Peers() []torrent.Peer {
	return t.torrent.Peers()
}

func (t *Torrent) Port() uint16 {
	return t.port
}

func (t *Torrent) Start() error {
	subBucket := strconv.FormatUint(t.id, 10)
	err := t.session.db.Update(func(tx *bolt.Tx) error {
		b := tx.Bucket(torrentsBucket).Bucket([]byte(subBucket))<commit_msg>add type aliases for session<commit_after>package session

import (
	"strconv"

	"github.com/boltdb/bolt"
	"github.com/cenkalti/rain/internal/torrent"
	"github.com/nictuku/dht"
)

type TorrentStats = torrent.Stats
type Tracker = torrent.Tracker
type Peer = torrent.Peer

type Torrent struct {
	id           uint64
	port         uint16
	dhtAnnouncer *dhtAnnouncer
	session      *Session
	torrent      *torrent.Torrent
	removed      chan struct{}
}

func (t *Torrent) ID() uint64 {
	return t.id
}

func (t *Torrent) Name() string {
	return t.torrent.Name()
}

func (t *Torrent) InfoHash() string {
	return t.torrent.InfoHash()
}

func (t *Torrent) Stats() TorrentStats {
	return t.torrent.Stats()
}

func (t *Torrent) Trackers() []Tracker {
	return t.torrent.Trackers()
}

func (t *Torrent) Peers() []Peer {
	return t.torrent.Peers()
}

func (t *Torrent) Port() uint16 {
	return t.port
}

func (t *Torrent) Start() error {
	subBucket := strconv.FormatUint(t.id, 10)
	err := t.session.db.Update(func(tx *bolt.Tx) error {
		b := tx.Bucket(torrentsBucket).Bucket([]byte(subBucket))
{'fraction_non_alphanumeric': 0.14299563742123123, 'fraction_numerical': 0.009694619486185167, 'mean_word_length': 3.7557603686635943, 'pattern_counts': {'":': 0, '<': 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': '4075244', 'n_tokens_mistral': 824, 'n_tokens_neox': 792, 'n_words': 184}