Skip to content

Commit 9a984c0

Browse files
authored
Merge pull request #266 from Bwko/lint/repo_mirror
Lint models/repo_mirror.go
2 parents fe3908d + 7bf7042 commit 9a984c0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

models/repo_mirror.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"code.gitea.io/gitea/modules/sync"
2020
)
2121

22+
// MirrorQueue holds an UniqueQueue object of the mirror
2223
var MirrorQueue = sync.NewUniqueQueue(setting.Repository.MirrorQueueLength)
2324

2425
// Mirror represents mirror information of a repository.
@@ -37,16 +38,19 @@ type Mirror struct {
3738
address string `xorm:"-"`
3839
}
3940

41+
// BeforeInsert will be invoked by XORM before inserting a record
4042
func (m *Mirror) BeforeInsert() {
4143
m.UpdatedUnix = time.Now().Unix()
4244
m.NextUpdateUnix = m.NextUpdate.Unix()
4345
}
4446

47+
// BeforeUpdate is invoked from XORM before updating this object.
4548
func (m *Mirror) BeforeUpdate() {
4649
m.UpdatedUnix = time.Now().Unix()
4750
m.NextUpdateUnix = m.NextUpdate.Unix()
4851
}
4952

53+
// AfterSet is invoked from XORM after setting the value of a field of this object.
5054
func (m *Mirror) AfterSet(colName string, _ xorm.Cell) {
5155
var err error
5256
switch colName {
@@ -180,10 +184,12 @@ func updateMirror(e Engine, m *Mirror) error {
180184
return err
181185
}
182186

187+
// UpdateMirror updates the mirror
183188
func UpdateMirror(m *Mirror) error {
184189
return updateMirror(x, m)
185190
}
186191

192+
// DeleteMirrorByRepoID deletes a mirror by repoID
187193
func DeleteMirrorByRepoID(repoID int64) error {
188194
_, err := x.Delete(&Mirror{RepoID: repoID})
189195
return err
@@ -241,6 +247,7 @@ func SyncMirrors() {
241247
}
242248
}
243249

250+
// InitSyncMirrors initializes a go routine to sync the mirros
244251
func InitSyncMirrors() {
245252
go SyncMirrors()
246253
}

0 commit comments

Comments
 (0)