docstring_tokens stringlengths 0 76.5k | code_tokens stringlengths 75 1.81M | label_window listlengths 4 2.12k | html_url stringlengths 74 116 | file_name stringlengths 3 311 |
|---|---|---|---|---|
err = decodeResultRuleToken(dec, ent)
if err != nil {
if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResultRules err: %s", err) | <mask> } else {
<mask> return
<mask> }
<mask>
<mask> i := 0
<mask> for {
<mask> var keyToken json.Token
<mask> keyToken, err = dec.Token()
<mask> if err != nil {
<mask> if err != io.EOF {
<mask> log.Debug("decodeResultRules err: %s", err)
<mask> }
<mask>
<mask> return
<mask> }
<mask>
<mask> if d, ok := keyToken.(json.Delim); ok {
<mask> switch d {
<mask> case '}':
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove if d, ok := keyToken.(json.Delim); ok {
switch d {
case '}':
i++
case ']':
return
default:
// Go on.
}
continue
}
</s> add return
}
}
} </s> remove return
</s> add if d, ok := keyToken.(json.Delim); ok {
switch d {
case '}':
i++
case ']':
return ErrEndOfToken
default:
// Go on. </s> remove if d, ok := delimToken.(json.Delim); ok {
if d != '[' {
log.Debug("decodeResultRules: unexpected delim %q", d)
}
} else {
</s> add if d, ok := delimToken.(json.Delim); !ok { </s> remove if err != io.EOF {
log.Debug("decodeResult err: %s", err)
</s> add if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResult: %s", err) </s> remove if err != io.EOF {
log.Debug("decodeResultDNSRewriteResult err: %s", err)
</s> add if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResultDNSRewriteResult: %s", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go |
return
}
}
} | <mask>
<mask> return
<mask> }
<mask>
<mask> if d, ok := keyToken.(json.Delim); ok {
<mask> switch d {
<mask> case '}':
<mask> i++
<mask> case ']':
<mask> return
<mask> default:
<mask> // Go on.
<mask> }
<mask>
<mask> continue
<mask> }
<mask>
<mask> key, ok := keyToken.(string)
<mask> if !ok {
<mask> log.Debug("decodeResultRules: keyToken is %T (%[1]v) and not string", keyToken)
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove return
</s> add if d, ok := keyToken.(json.Delim); ok {
switch d {
case '}':
i++
case ']':
return ErrEndOfToken
default:
// Go on. </s> remove key, ok := keyToken.(string)
if !ok {
log.Debug("decodeResult: keyToken is %T (%[1]v) and not string", keyToken)
return
}
</s> add </s> remove key, ok := keyToken.(string)
if !ok {
log.Debug("decodeResultDNSRewriteResult: keyToken is %T (%[1]v) and not string", keyToken)
return
}
</s> add </s> remove if d, ok := keyToken.(json.Delim); ok {
if d == '}' {
return
}
</s> add if key == "" { </s> remove if d, ok := keyToken.(json.Delim); ok {
if d == '}' {
return
}
</s> add if key == "" { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go |
// decodeResultRuleToken decodes the tokens of "Rules" type to the logEntry ent.
func decodeResultRuleToken(dec *json.Decoder, ent *logEntry) (err error) {
i := 0
for {
var keyToken json.Token
keyToken, err = dec.Token()
if err != nil {
// Don't wrap the error, because it's informative enough as is.
return err
} | <mask>
<mask> continue
<mask> }
<mask>
<mask> key, ok := keyToken.(string)
<mask> if !ok {
<mask> log.Debug("decodeResultRules: keyToken is %T (%[1]v) and not string", keyToken)
<mask>
<mask> return
<mask> }
<mask>
<mask> decodeResultRuleKey(key, i, dec, ent)
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove return
</s> add if d, ok := keyToken.(json.Delim); ok {
switch d {
case '}':
i++
case ']':
return ErrEndOfToken
default:
// Go on. </s> remove decodeResultRuleKey(key, i, dec, ent)
</s> add continue
}
key, ok := keyToken.(string)
if !ok {
return fmt.Errorf("keyToken is %T (%[1]v) and not string", keyToken) </s> remove key, ok := keyToken.(string)
if !ok {
log.Debug("decodeResult: keyToken is %T (%[1]v) and not string", keyToken)
return
}
</s> add </s> remove key, ok := keyToken.(string)
if !ok {
log.Debug("decodeResultDNSRewriteResult: keyToken is %T (%[1]v) and not string", keyToken)
return
}
</s> add </s> remove if d, ok := keyToken.(json.Delim); ok {
switch d {
case '}':
i++
case ']':
return
default:
// Go on.
}
continue
}
</s> add return
}
}
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go |
if d, ok := keyToken.(json.Delim); ok {
switch d {
case '}':
i++
case ']':
return ErrEndOfToken
default:
// Go on. | <mask> key, ok := keyToken.(string)
<mask> if !ok {
<mask> log.Debug("decodeResultRules: keyToken is %T (%[1]v) and not string", keyToken)
<mask>
<mask> return
<mask> }
<mask>
<mask> decodeResultRuleKey(key, i, dec, ent)
<mask> }
<mask> }
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove decodeResultRuleKey(key, i, dec, ent)
</s> add continue
}
key, ok := keyToken.(string)
if !ok {
return fmt.Errorf("keyToken is %T (%[1]v) and not string", keyToken) </s> remove key, ok := keyToken.(string)
if !ok {
log.Debug("decodeResult: keyToken is %T (%[1]v) and not string", keyToken)
return
}
</s> add </s> remove key, ok := keyToken.(string)
if !ok {
log.Debug("decodeResultDNSRewriteResult: keyToken is %T (%[1]v) and not string", keyToken)
return
}
</s> add </s> remove key, ok := keyToken.(string)
if !ok {
log.Debug("decodeResultRules: keyToken is %T (%[1]v) and not string", keyToken)
</s> add // decodeResultRuleToken decodes the tokens of "Rules" type to the logEntry ent.
func decodeResultRuleToken(dec *json.Decoder, ent *logEntry) (err error) {
i := 0
for {
var keyToken json.Token
keyToken, err = dec.Token()
if err != nil {
// Don't wrap the error, because it's informative enough as is.
return err
} </s> remove if d, ok := keyToken.(json.Delim); ok {
switch d {
case '}':
i++
case ']':
return
default:
// Go on.
}
continue
}
</s> add return
}
}
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go |
continue
}
key, ok := keyToken.(string)
if !ok {
return fmt.Errorf("keyToken is %T (%[1]v) and not string", keyToken) | <mask>
<mask> return
<mask> }
<mask>
<mask> decodeResultRuleKey(key, i, dec, ent)
<mask> }
<mask> }
<mask> }
<mask>
<mask> // decodeResultReverseHosts parses the dec's tokens into ent interpreting it as
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove key, ok := keyToken.(string)
if !ok {
log.Debug("decodeResultRules: keyToken is %T (%[1]v) and not string", keyToken)
</s> add // decodeResultRuleToken decodes the tokens of "Rules" type to the logEntry ent.
func decodeResultRuleToken(dec *json.Decoder, ent *logEntry) (err error) {
i := 0
for {
var keyToken json.Token
keyToken, err = dec.Token()
if err != nil {
// Don't wrap the error, because it's informative enough as is.
return err
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go |
decodeResultRuleKey(key, i, dec, ent) | <mask> if !ok {
<mask> return fmt.Errorf("keyToken is %T (%[1]v) and not string", keyToken)
<mask> }
<mask> }
<mask> }
<mask>
<mask> // decodeResultReverseHosts parses the dec's tokens into ent interpreting it as
<mask> // the result of hosts container's $dnsrewrite rule. It assumes there are no
<mask> // other occurrences of DNSRewriteResult in the entry since hosts container's
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove decodeResultRuleKey(key, i, dec, ent)
</s> add continue
}
key, ok := keyToken.(string)
if !ok {
return fmt.Errorf("keyToken is %T (%[1]v) and not string", keyToken) </s> remove key, ok := keyToken.(string)
if !ok {
log.Debug("decodeResultRules: keyToken is %T (%[1]v) and not string", keyToken)
</s> add // decodeResultRuleToken decodes the tokens of "Rules" type to the logEntry ent.
func decodeResultRuleToken(dec *json.Decoder, ent *logEntry) (err error) {
i := 0
for {
var keyToken json.Token
keyToken, err = dec.Token()
if err != nil {
// Don't wrap the error, because it's informative enough as is.
return err
} | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go |
// decodeResultIPList parses the dec's tokens into logEntry ent interpreting it
// as the result IP addresses list. | <mask> }
<mask>
<mask> func decodeResultIPList(dec *json.Decoder, ent *logEntry) {
<mask> for {
<mask> itemToken, err := dec.Token()
<mask> if err != nil {
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove keyToken, err := dec.Token()
</s> add key, err := parseKeyToken(dec) </s> remove keyToken, err := dec.Token()
</s> add key, err := parseKeyToken(dec) </s> remove if err != io.EOF {
log.Debug("decodeResultDNSRewriteResult err: %s", err)
</s> add if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResultDNSRewriteResult: %s", err) | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go |
// decodeResultDNSRewriteResultKey decodes the token of "DNSRewriteResult" type
// to the logEntry struct. | <mask> }
<mask>
<mask> func decodeResultDNSRewriteResultKey(key string, dec *json.Decoder, ent *logEntry) {
<mask> var err error
<mask>
<mask> switch key {
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove keyToken, err := dec.Token()
</s> add key, err := parseKeyToken(dec) </s> remove keyToken, err := dec.Token()
</s> add key, err := parseKeyToken(dec) | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go |
ent.parseDNSRewriteResultIPs() | <mask> if err != nil {
<mask> log.Debug("decodeResultDNSRewriteResultKey response err: %s", err)
<mask> }
<mask>
<mask> for rrType, rrValues := range ent.Result.DNSRewriteResult.Response {
<mask> switch rrType {
<mask> case
<mask> dns.TypeA,
<mask> dns.TypeAAAA:
<mask> for i, v := range rrValues {
<mask> s, _ := v.(string)
<mask> rrValues[i] = net.ParseIP(s)
<mask> }
<mask> default:
<mask> // Go on.
<mask> }
<mask> }
<mask> default:
<mask> // Go on.
<mask> }
<mask> }
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove return
</s> add if d, ok := keyToken.(json.Delim); ok {
switch d {
case '}':
i++
case ']':
return ErrEndOfToken
default:
// Go on. </s> remove if d, ok := keyToken.(json.Delim); ok {
switch d {
case '}':
i++
case ']':
return
default:
// Go on.
}
continue
}
</s> add return
}
}
} </s> remove i := 0
for {
var keyToken json.Token
keyToken, err = dec.Token()
if err != nil {
if err != io.EOF {
log.Debug("decodeResultRules err: %s", err)
}
return
</s> add err = decodeResultRuleToken(dec, ent)
if err != nil {
if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResultRules err: %s", err) </s> remove if err != io.EOF {
log.Debug("decodeResult err: %s", err)
</s> add if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResult: %s", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go |
// decodeResultDNSRewriteResult parses the dec's tokens into logEntry ent
// interpreting it as the result DNSRewriteResult. | <mask> // Go on.
<mask> }
<mask> }
<mask>
<mask> func decodeResultDNSRewriteResult(dec *json.Decoder, ent *logEntry) {
<mask> for {
<mask> key, err := parseKeyToken(dec)
<mask> if err != nil {
<mask> if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove if err != io.EOF {
log.Debug("decodeResultDNSRewriteResult err: %s", err)
</s> add if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResultDNSRewriteResult: %s", err) </s> remove keyToken, err := dec.Token()
</s> add key, err := parseKeyToken(dec) </s> remove keyToken, err := dec.Token()
</s> add key, err := parseKeyToken(dec) </s> remove if err != io.EOF {
log.Debug("decodeResult err: %s", err)
</s> add if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResult: %s", err) | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go |
key, err := parseKeyToken(dec) | <mask> }
<mask>
<mask> func decodeResultDNSRewriteResult(dec *json.Decoder, ent *logEntry) {
<mask> for {
<mask> keyToken, err := dec.Token()
<mask> if err != nil {
<mask> if err != io.EOF {
<mask> log.Debug("decodeResultDNSRewriteResult err: %s", err)
<mask> }
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove if err != io.EOF {
log.Debug("decodeResultDNSRewriteResult err: %s", err)
</s> add if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResultDNSRewriteResult: %s", err) </s> remove keyToken, err := dec.Token()
</s> add key, err := parseKeyToken(dec) </s> remove if err != io.EOF {
log.Debug("decodeResult err: %s", err)
</s> add if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResult: %s", err) </s> remove i := 0
for {
var keyToken json.Token
keyToken, err = dec.Token()
if err != nil {
if err != io.EOF {
log.Debug("decodeResultRules err: %s", err)
}
return
</s> add err = decodeResultRuleToken(dec, ent)
if err != nil {
if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResultRules err: %s", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go |
if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResultDNSRewriteResult: %s", err) | <mask> func decodeResultDNSRewriteResult(dec *json.Decoder, ent *logEntry) {
<mask> for {
<mask> keyToken, err := dec.Token()
<mask> if err != nil {
<mask> if err != io.EOF {
<mask> log.Debug("decodeResultDNSRewriteResult err: %s", err)
<mask> }
<mask>
<mask> return
<mask> }
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove keyToken, err := dec.Token()
</s> add key, err := parseKeyToken(dec) </s> remove keyToken, err := dec.Token()
</s> add key, err := parseKeyToken(dec) </s> remove if err != io.EOF {
log.Debug("decodeResult err: %s", err)
</s> add if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResult: %s", err) </s> remove i := 0
for {
var keyToken json.Token
keyToken, err = dec.Token()
if err != nil {
if err != io.EOF {
log.Debug("decodeResultRules err: %s", err)
}
return
</s> add err = decodeResultRuleToken(dec, ent)
if err != nil {
if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResultRules err: %s", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go |
if key == "" { | <mask>
<mask> return
<mask> }
<mask>
<mask> if d, ok := keyToken.(json.Delim); ok {
<mask> if d == '}' {
<mask> return
<mask> }
<mask>
<mask> continue
<mask> }
<mask>
<mask> key, ok := keyToken.(string)
<mask> if !ok {
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove if d, ok := keyToken.(json.Delim); ok {
if d == '}' {
return
}
</s> add if key == "" { </s> remove if d, ok := keyToken.(json.Delim); ok {
switch d {
case '}':
i++
case ']':
return
default:
// Go on.
}
continue
}
</s> add return
}
}
} </s> remove return
</s> add if d, ok := keyToken.(json.Delim); ok {
switch d {
case '}':
i++
case ']':
return ErrEndOfToken
default:
// Go on. </s> remove if d, ok := delimToken.(json.Delim); ok {
if d != '[' {
log.Debug("decodeResultRules: unexpected delim %q", d)
}
} else {
</s> add if d, ok := delimToken.(json.Delim); !ok { </s> remove key, ok := keyToken.(string)
if !ok {
log.Debug("decodeResult: keyToken is %T (%[1]v) and not string", keyToken)
return
}
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go |
<mask>
<mask> continue
<mask> }
<mask>
<mask> key, ok := keyToken.(string)
<mask> if !ok {
<mask> log.Debug("decodeResultDNSRewriteResult: keyToken is %T (%[1]v) and not string", keyToken)
<mask>
<mask> return
<mask> }
<mask>
<mask> decodeResultDNSRewriteResultKey(key, dec, ent)
<mask> }
<mask> }
<mask>
<mask> // translateResult converts some fields of the ent.Result to the format
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove key, ok := keyToken.(string)
if !ok {
log.Debug("decodeResult: keyToken is %T (%[1]v) and not string", keyToken)
return
}
</s> add </s> remove decodeResultRuleKey(key, i, dec, ent)
</s> add continue
}
key, ok := keyToken.(string)
if !ok {
return fmt.Errorf("keyToken is %T (%[1]v) and not string", keyToken) </s> remove return
</s> add if d, ok := keyToken.(json.Delim); ok {
switch d {
case '}':
i++
case ']':
return ErrEndOfToken
default:
// Go on. </s> remove if d, ok := keyToken.(json.Delim); ok {
switch d {
case '}':
i++
case ']':
return
default:
// Go on.
}
continue
}
</s> add return
}
}
} </s> remove key, ok := keyToken.(string)
if !ok {
log.Debug("decodeResultRules: keyToken is %T (%[1]v) and not string", keyToken)
</s> add // decodeResultRuleToken decodes the tokens of "Rules" type to the logEntry ent.
func decodeResultRuleToken(dec *json.Decoder, ent *logEntry) (err error) {
i := 0
for {
var keyToken json.Token
keyToken, err = dec.Token()
if err != nil {
// Don't wrap the error, because it's informative enough as is.
return err
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go | |
key, err := parseKeyToken(dec) | <mask> func decodeResult(dec *json.Decoder, ent *logEntry) {
<mask> defer translateResult(ent)
<mask>
<mask> for {
<mask> keyToken, err := dec.Token()
<mask> if err != nil {
<mask> if err != io.EOF {
<mask> log.Debug("decodeResult err: %s", err)
<mask> }
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove if err != io.EOF {
log.Debug("decodeResultDNSRewriteResult err: %s", err)
</s> add if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResultDNSRewriteResult: %s", err) </s> remove keyToken, err := dec.Token()
</s> add key, err := parseKeyToken(dec) </s> remove if err != io.EOF {
log.Debug("decodeResult err: %s", err)
</s> add if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResult: %s", err) </s> remove i := 0
for {
var keyToken json.Token
keyToken, err = dec.Token()
if err != nil {
if err != io.EOF {
log.Debug("decodeResultRules err: %s", err)
}
return
</s> add err = decodeResultRuleToken(dec, ent)
if err != nil {
if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResultRules err: %s", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go |
if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResult: %s", err) | <mask>
<mask> for {
<mask> keyToken, err := dec.Token()
<mask> if err != nil {
<mask> if err != io.EOF {
<mask> log.Debug("decodeResult err: %s", err)
<mask> }
<mask>
<mask> return
<mask> }
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove keyToken, err := dec.Token()
</s> add key, err := parseKeyToken(dec) </s> remove if err != io.EOF {
log.Debug("decodeResultDNSRewriteResult err: %s", err)
</s> add if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResultDNSRewriteResult: %s", err) </s> remove i := 0
for {
var keyToken json.Token
keyToken, err = dec.Token()
if err != nil {
if err != io.EOF {
log.Debug("decodeResultRules err: %s", err)
}
return
</s> add err = decodeResultRuleToken(dec, ent)
if err != nil {
if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResultRules err: %s", err) </s> remove keyToken, err := dec.Token()
</s> add key, err := parseKeyToken(dec) </s> remove log.Error("querylog: opening qlog reader: %s", err)
return entries, oldest, 0
}
defer func() {
closeErr := r.Close()
if closeErr != nil {
log.Error("querylog: closing file: %s", err)
}
}()
if params.olderThan.IsZero() {
err = r.SeekStart()
} else {
err = r.seekTS(params.olderThan.UnixNano())
if err == nil {
// Read to the next record, because we only need the one that goes
// after it.
_, err = r.ReadNext()
}
</s> add return nil, fmt.Errorf("opening qlog reader: %s", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go |
if key == "" { | <mask>
<mask> return
<mask> }
<mask>
<mask> if d, ok := keyToken.(json.Delim); ok {
<mask> if d == '}' {
<mask> return
<mask> }
<mask>
<mask> continue
<mask> }
<mask>
<mask> key, ok := keyToken.(string)
<mask> if !ok {
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go |
<mask>
<mask> continue
<mask> }
<mask>
<mask> key, ok := keyToken.(string)
<mask> if !ok {
<mask> log.Debug("decodeResult: keyToken is %T (%[1]v) and not string", keyToken)
<mask>
<mask> return
<mask> }
<mask>
<mask> decHandler, ok := resultDecHandlers[key]
<mask> if ok {
<mask> decHandler(dec, ent)
<mask>
<mask> continue
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove if d, ok := keyToken.(json.Delim); ok {
switch d {
case '}':
i++
case ']':
return
default:
// Go on.
}
continue
}
</s> add return
}
}
} </s> remove key, ok := keyToken.(string)
if !ok {
log.Debug("decodeResultDNSRewriteResult: keyToken is %T (%[1]v) and not string", keyToken)
return
}
</s> add </s> remove return
</s> add if d, ok := keyToken.(json.Delim); ok {
switch d {
case '}':
i++
case ']':
return ErrEndOfToken
default:
// Go on. </s> remove decodeResultRuleKey(key, i, dec, ent)
</s> add continue
}
key, ok := keyToken.(string)
if !ok {
return fmt.Errorf("keyToken is %T (%[1]v) and not string", keyToken) </s> remove key, ok := keyToken.(string)
if !ok {
log.Debug("decodeResultRules: keyToken is %T (%[1]v) and not string", keyToken)
</s> add // decodeResultRuleToken decodes the tokens of "Rules" type to the logEntry ent.
func decodeResultRuleToken(dec *json.Decoder, ent *logEntry) (err error) {
i := 0
for {
var keyToken json.Token
keyToken, err = dec.Token()
if err != nil {
// Don't wrap the error, because it's informative enough as is.
return err
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go | |
// resultHandlers is the map of log entry decode handlers for various keys. | <mask> }
<mask> }
<mask>
<mask> var resultHandlers = map[string]logEntryHandler{
<mask> "IsFiltered": func(t json.Token, ent *logEntry) error {
<mask> v, ok := t.(bool)
<mask> if !ok {
<mask> return nil
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove key, ok := keyToken.(string)
if !ok {
log.Debug("decodeResultRules: keyToken is %T (%[1]v) and not string", keyToken)
</s> add // decodeResultRuleToken decodes the tokens of "Rules" type to the logEntry ent.
func decodeResultRuleToken(dec *json.Decoder, ent *logEntry) (err error) {
i := 0
for {
var keyToken json.Token
keyToken, err = dec.Token()
if err != nil {
// Don't wrap the error, because it's informative enough as is.
return err
} </s> remove if d, ok := keyToken.(json.Delim); ok {
if d == '}' {
return
}
</s> add if key == "" { </s> remove if d, ok := keyToken.(json.Delim); ok {
if d == '}' {
return
}
</s> add if key == "" { | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go |
// resultDecHandlers is the map of decode handlers for various keys. | <mask> }
<mask>
<mask> var resultDecHandlers = map[string]func(dec *json.Decoder, ent *logEntry){
<mask> "ReverseHosts": decodeResultReverseHosts,
<mask> "IPList": decodeResultIPList,
<mask> "Rules": decodeResultRules,
<mask> "DNSRewriteResult": decodeResultDNSRewriteResult,
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove key, ok := keyToken.(string)
if !ok {
log.Debug("decodeResultRules: keyToken is %T (%[1]v) and not string", keyToken)
</s> add // decodeResultRuleToken decodes the tokens of "Rules" type to the logEntry ent.
func decodeResultRuleToken(dec *json.Decoder, ent *logEntry) (err error) {
i := 0
for {
var keyToken json.Token
keyToken, err = dec.Token()
if err != nil {
// Don't wrap the error, because it's informative enough as is.
return err
} | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go |
// decodeLogEntry decodes string str to logEntry ent. | <mask> "Rules": decodeResultRules,
<mask> "DNSRewriteResult": decodeResultDNSRewriteResult,
<mask> }
<mask>
<mask> func decodeLogEntry(ent *logEntry, str string) {
<mask> dec := json.NewDecoder(strings.NewReader(str))
<mask> dec.UseNumber()
<mask>
<mask> for {
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove func NewTestQLogFileData(t *testing.T, data string) (file *QLogFile) {
</s> add func newTestQLogFileData(t *testing.T, data string) (file *qLogFile) { </s> remove // NewQLogFile initializes a new instance of the QLogFile
func NewQLogFile(path string) (*QLogFile, error) {
</s> add // newQLogFile initializes a new instance of the qLogFile.
func newQLogFile(path string) (qf *qLogFile, err error) { </s> remove // readQLogTimestamp reads the timestamp field from the query log line
</s> add // readQLogTimestamp reads the timestamp field from the query log line. | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/decode.go |
// queryLogFileName is a name of the log file. ".gz" extension is added later
// during compression.
const queryLogFileName = "querylog.json" | <mask> "github.com/AdguardTeam/golibs/timeutil"
<mask> "github.com/miekg/dns"
<mask> )
<mask>
<mask> const (
<mask> queryLogFileName = "querylog.json" // .gz added during compression
<mask> )
<mask>
<mask> // queryLog is a structure that writes and reads the DNS query log
<mask> type queryLog struct {
<mask> findClient func(ids []string) (c *Client, err error)
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // queryLog is a structure that writes and reads the DNS query log
</s> add // queryLog is a structure that writes and reads the DNS query log. </s> remove findClient func(ids []string) (c *Client, err error)
</s> add </s> remove conf *Config
</s> add conf *Config
anonymizer *aghnet.IPMut
findClient func(ids []string) (c *Client, err error) </s> remove // Please note that this is a stateful object.
// Internally, it contains a pointer to a particular query log file, and
// to a specific position in this file, and it reads lines in reverse order
// starting from that position.
type QLogReader struct {
// qFiles - array with the query log files
// The order is - from oldest to newest
qFiles []*QLogFile
currentFile int // Index of the current file
</s> add // Please note that this is a stateful object. Internally, it contains a
// pointer to a particular query log file, and to a specific position in this
// file, and it reads lines in reverse order starting from that position.
type qLogReader struct {
// qFiles is an array with the query log files. The order is from oldest
// to newest.
qFiles []*qLogFile
// currentFile is the index of the current file.
currentFile int </s> remove // TODO: Find a way to grow buffer instead of relying on this value when reading strings
const maxEntrySize = 16 * 1024
</s> add // qLogFile represents a single query log file. It allows reading from the
// file in the reverse order.
//
// Please note, that this is a stateful object. Internally, it contains a
// pointer to a specific position in the file, and it reads lines in reverse
// order starting from that position.
type qLogFile struct {
// file is the query log file.
file *os.File | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlog.go |
// queryLog is a structure that writes and reads the DNS query log. | <mask> const (
<mask> queryLogFileName = "querylog.json" // .gz added during compression
<mask> )
<mask>
<mask> // queryLog is a structure that writes and reads the DNS query log
<mask> type queryLog struct {
<mask> findClient func(ids []string) (c *Client, err error)
<mask>
<mask> // confMu protects conf.
<mask> confMu *sync.RWMutex
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove const (
queryLogFileName = "querylog.json" // .gz added during compression
)
</s> add // queryLogFileName is a name of the log file. ".gz" extension is added later
// during compression.
const queryLogFileName = "querylog.json" </s> remove findClient func(ids []string) (c *Client, err error)
</s> add </s> remove conf *Config
</s> add conf *Config
anonymizer *aghnet.IPMut
findClient func(ids []string) (c *Client, err error) </s> remove // Please note that this is a stateful object.
// Internally, it contains a pointer to a particular query log file, and
// to a specific position in this file, and it reads lines in reverse order
// starting from that position.
type QLogReader struct {
// qFiles - array with the query log files
// The order is - from oldest to newest
qFiles []*QLogFile
currentFile int // Index of the current file
</s> add // Please note that this is a stateful object. Internally, it contains a
// pointer to a particular query log file, and to a specific position in this
// file, and it reads lines in reverse order starting from that position.
type qLogReader struct {
// qFiles is an array with the query log files. The order is from oldest
// to newest.
qFiles []*qLogFile
// currentFile is the index of the current file.
currentFile int </s> remove // TODO: Find a way to grow buffer instead of relying on this value when reading strings
const maxEntrySize = 16 * 1024
</s> add // qLogFile represents a single query log file. It allows reading from the
// file in the reverse order.
//
// Please note, that this is a stateful object. Internally, it contains a
// pointer to a specific position in the file, and it reads lines in reverse
// order starting from that position.
type qLogFile struct {
// file is the query log file.
file *os.File | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlog.go |
<mask> )
<mask>
<mask> // queryLog is a structure that writes and reads the DNS query log
<mask> type queryLog struct {
<mask> findClient func(ids []string) (c *Client, err error)
<mask>
<mask> // confMu protects conf.
<mask> confMu *sync.RWMutex
<mask> conf *Config
<mask>
<mask> // logFile is the path to the log file.
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // queryLog is a structure that writes and reads the DNS query log
</s> add // queryLog is a structure that writes and reads the DNS query log. </s> remove conf *Config
</s> add conf *Config
anonymizer *aghnet.IPMut
findClient func(ids []string) (c *Client, err error) </s> remove const (
queryLogFileName = "querylog.json" // .gz added during compression
)
</s> add // queryLogFileName is a name of the log file. ".gz" extension is added later
// during compression.
const queryLogFileName = "querylog.json" </s> remove // Please note that this is a stateful object.
// Internally, it contains a pointer to a particular query log file, and
// to a specific position in this file, and it reads lines in reverse order
// starting from that position.
type QLogReader struct {
// qFiles - array with the query log files
// The order is - from oldest to newest
qFiles []*QLogFile
currentFile int // Index of the current file
</s> add // Please note that this is a stateful object. Internally, it contains a
// pointer to a particular query log file, and to a specific position in this
// file, and it reads lines in reverse order starting from that position.
type qLogReader struct {
// qFiles is an array with the query log files. The order is from oldest
// to newest.
qFiles []*qLogFile
// currentFile is the index of the current file.
currentFile int </s> remove // bufferLock protects buffer.
bufferLock sync.RWMutex
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlog.go | |
conf *Config
anonymizer *aghnet.IPMut
findClient func(ids []string) (c *Client, err error) | <mask> findClient func(ids []string) (c *Client, err error)
<mask>
<mask> // confMu protects conf.
<mask> confMu *sync.RWMutex
<mask> conf *Config
<mask>
<mask> // logFile is the path to the log file.
<mask> logFile string
<mask>
<mask> // bufferLock protects buffer.
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove findClient func(ids []string) (c *Client, err error)
</s> add </s> remove // queryLog is a structure that writes and reads the DNS query log
</s> add // queryLog is a structure that writes and reads the DNS query log. </s> remove // bufferLock protects buffer.
bufferLock sync.RWMutex
</s> add </s> remove const (
queryLogFileName = "querylog.json" // .gz added during compression
)
</s> add // queryLogFileName is a name of the log file. ".gz" extension is added later
// during compression.
const queryLogFileName = "querylog.json" </s> remove fileFlushLock sync.Mutex // synchronize a file-flushing goroutine and main thread
flushPending bool // don't start another goroutine while the previous one is still running
</s> add // bufferLock protects buffer.
bufferLock sync.RWMutex
// fileFlushLock synchronizes a file-flushing goroutine and main thread.
fileFlushLock sync.Mutex | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlog.go |
<mask>
<mask> // logFile is the path to the log file.
<mask> logFile string
<mask>
<mask> // bufferLock protects buffer.
<mask> bufferLock sync.RWMutex
<mask> // buffer contains recent log entries. The entries in this buffer must not
<mask> // be modified.
<mask> buffer []*logEntry
<mask>
<mask> fileFlushLock sync.Mutex // synchronize a file-flushing goroutine and main thread
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove fileFlushLock sync.Mutex // synchronize a file-flushing goroutine and main thread
flushPending bool // don't start another goroutine while the previous one is still running
</s> add // bufferLock protects buffer.
bufferLock sync.RWMutex
// fileFlushLock synchronizes a file-flushing goroutine and main thread.
fileFlushLock sync.Mutex </s> remove conf *Config
</s> add conf *Config
anonymizer *aghnet.IPMut
findClient func(ids []string) (c *Client, err error) </s> remove anonymizer *aghnet.IPMut
</s> add flushPending bool </s> remove // QLogFile represents a single query log file
// It allows reading from the file in the reverse order
//
// Please note that this is a stateful object.
// Internally, it contains a pointer to a specific position in the file,
// and it reads lines in reverse order starting from that position.
type QLogFile struct {
file *os.File // the query log file
position int64 // current position in the file
buffer []byte // buffer that we've read from the file
bufferStart int64 // start of the buffer (in the file)
bufferLen int // buffer len
lock sync.Mutex // We use mutex to make it thread-safe
</s> add // lock is a mutex to make it thread-safe.
lock sync.Mutex
// position is the position in the file.
position int64
// bufferStart is the start of the buffer (in the file).
bufferStart int64
// bufferLen is the length of the buffer.
bufferLen int </s> remove findClient func(ids []string) (c *Client, err error)
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlog.go | |
// bufferLock protects buffer.
bufferLock sync.RWMutex
// fileFlushLock synchronizes a file-flushing goroutine and main thread.
fileFlushLock sync.Mutex | <mask> // buffer contains recent log entries. The entries in this buffer must not
<mask> // be modified.
<mask> buffer []*logEntry
<mask>
<mask> fileFlushLock sync.Mutex // synchronize a file-flushing goroutine and main thread
<mask> flushPending bool // don't start another goroutine while the previous one is still running
<mask> fileWriteLock sync.Mutex
<mask>
<mask> anonymizer *aghnet.IPMut
<mask> }
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove anonymizer *aghnet.IPMut
</s> add flushPending bool </s> remove // bufferLock protects buffer.
bufferLock sync.RWMutex
</s> add </s> remove // QLogFile represents a single query log file
// It allows reading from the file in the reverse order
//
// Please note that this is a stateful object.
// Internally, it contains a pointer to a specific position in the file,
// and it reads lines in reverse order starting from that position.
type QLogFile struct {
file *os.File // the query log file
position int64 // current position in the file
buffer []byte // buffer that we've read from the file
bufferStart int64 // start of the buffer (in the file)
bufferLen int // buffer len
lock sync.Mutex // We use mutex to make it thread-safe
</s> add // lock is a mutex to make it thread-safe.
lock sync.Mutex
// position is the position in the file.
position int64
// bufferStart is the start of the buffer (in the file).
bufferStart int64
// bufferLen is the length of the buffer.
bufferLen int </s> remove // buffer should be enough for at least this number of entries
const bufferSize = 100 * maxEntrySize
</s> add // buffer that we've read from the file.
buffer []byte </s> remove // TODO: Find a way to grow buffer instead of relying on this value when reading strings
const maxEntrySize = 16 * 1024
</s> add // qLogFile represents a single query log file. It allows reading from the
// file in the reverse order.
//
// Please note, that this is a stateful object. Internally, it contains a
// pointer to a specific position in the file, and it reads lines in reverse
// order starting from that position.
type qLogFile struct {
// file is the query log file.
file *os.File | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlog.go |
flushPending bool | <mask> fileFlushLock sync.Mutex // synchronize a file-flushing goroutine and main thread
<mask> flushPending bool // don't start another goroutine while the previous one is still running
<mask> fileWriteLock sync.Mutex
<mask>
<mask> anonymizer *aghnet.IPMut
<mask> }
<mask>
<mask> // ClientProto values are names of the client protocols.
<mask> type ClientProto string
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove fileFlushLock sync.Mutex // synchronize a file-flushing goroutine and main thread
flushPending bool // don't start another goroutine while the previous one is still running
</s> add // bufferLock protects buffer.
bufferLock sync.RWMutex
// fileFlushLock synchronizes a file-flushing goroutine and main thread.
fileFlushLock sync.Mutex </s> remove // bufferLock protects buffer.
bufferLock sync.RWMutex
</s> add </s> remove // QLogFile represents a single query log file
// It allows reading from the file in the reverse order
//
// Please note that this is a stateful object.
// Internally, it contains a pointer to a specific position in the file,
// and it reads lines in reverse order starting from that position.
type QLogFile struct {
file *os.File // the query log file
position int64 // current position in the file
buffer []byte // buffer that we've read from the file
bufferStart int64 // start of the buffer (in the file)
bufferLen int // buffer len
lock sync.Mutex // We use mutex to make it thread-safe
</s> add // lock is a mutex to make it thread-safe.
lock sync.Mutex
// position is the position in the file.
position int64
// bufferStart is the start of the buffer (in the file).
bufferStart int64
// bufferLen is the length of the buffer.
bufferLen int </s> remove } else if errors.Is(err, ErrTSTooLate) {
</s> add } else if errors.Is(err, errTSTooLate) { </s> remove } else if errors.Is(err, ErrTSNotFound) {
</s> add } else if errors.Is(err, errTSNotFound) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlog.go |
// newLogEntry creates an instance of logEntry from parameters.
func newLogEntry(params *AddParams) (entry *logEntry) { | <mask>
<mask> log.Debug("querylog: cleared")
<mask> }
<mask>
<mask> func (l *queryLog) Add(params *AddParams) {
<mask> var isEnabled, fileIsEnabled bool
<mask> var memSize uint32
<mask> func() {
<mask> l.confMu.RLock()
<mask> defer l.confMu.RUnlock()
<mask>
<mask> isEnabled, fileIsEnabled = l.conf.Enabled, l.conf.FileEnabled
<mask> memSize = l.conf.MemSize
<mask> }()
<mask>
<mask> if !isEnabled {
<mask> return
<mask> }
<mask>
<mask> err := params.validate()
<mask> if err != nil {
<mask> log.Error("querylog: adding record: %s, skipping", err)
<mask>
<mask> return
<mask> }
<mask>
<mask> if params.Result == nil {
<mask> params.Result = &filtering.Result{}
<mask> }
<mask>
<mask> now := time.Now()
<mask> q := params.Question.Question[0]
<mask> entry := &logEntry{
<mask> Time: now,
<mask>
<mask> QHost: strings.ToLower(q.Name[:len(q.Name)-1]),
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove entry := &logEntry{
Time: now,
</s> add entry = &logEntry{
// TODO(d.kolyshev): Export this timestamp to func params.
Time: time.Now(), </s> remove log.Error("querylog: opening qlog reader: %s", err)
return entries, oldest, 0
}
defer func() {
closeErr := r.Close()
if closeErr != nil {
log.Error("querylog: closing file: %s", err)
}
}()
if params.olderThan.IsZero() {
err = r.SeekStart()
} else {
err = r.seekTS(params.olderThan.UnixNano())
if err == nil {
// Read to the next record, because we only need the one that goes
// after it.
_, err = r.ReadNext()
}
</s> add return nil, fmt.Errorf("opening qlog reader: %s", err) </s> remove log.Debug("querylog: cannot seek to %s: %s", params.olderThan, err)
</s> add defer func() { err = errors.WithDeferred(err, r.Close()) }()
log.Debug("querylog: cannot seek to %s: %s", olderThan, err) </s> remove i := 0
for {
var keyToken json.Token
keyToken, err = dec.Token()
if err != nil {
if err != io.EOF {
log.Debug("decodeResultRules err: %s", err)
}
return
</s> add err = decodeResultRuleToken(dec, ent)
if err != nil {
if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResultRules err: %s", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"re... | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlog.go |
entry = &logEntry{
// TODO(d.kolyshev): Export this timestamp to func params.
Time: time.Now(), | <mask> }
<mask>
<mask> now := time.Now()
<mask> q := params.Question.Question[0]
<mask> entry := &logEntry{
<mask> Time: now,
<mask>
<mask> QHost: strings.ToLower(q.Name[:len(q.Name)-1]),
<mask> QType: dns.Type(q.Qtype).String(),
<mask> QClass: dns.Class(q.Qclass).String(),
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove func (l *queryLog) Add(params *AddParams) {
var isEnabled, fileIsEnabled bool
var memSize uint32
func() {
l.confMu.RLock()
defer l.confMu.RUnlock()
isEnabled, fileIsEnabled = l.conf.Enabled, l.conf.FileEnabled
memSize = l.conf.MemSize
}()
if !isEnabled {
return
}
err := params.validate()
if err != nil {
log.Error("querylog: adding record: %s, skipping", err)
return
}
if params.Result == nil {
params.Result = &filtering.Result{}
}
now := time.Now()
</s> add // newLogEntry creates an instance of logEntry from parameters.
func newLogEntry(params *AddParams) (entry *logEntry) { </s> remove // Looking for the end of line now
</s> add // Looking for the end of line now. </s> remove q := NewTestQLogFileData(t, data)
</s> add q := newTestQLogFileData(t, data) </s> remove // Shift to the older file
</s> add // Shift to the older file. </s> remove // Create the new QLogFile instance.
</s> add // Create the new qLogFile instance. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlog.go |
host string
answer net.IP
client net.IP
num int | <mask> addEntry(l, "test.example.org", net.IPv4(1, 1, 1, 3), net.IPv4(2, 2, 2, 3))
<mask> addEntry(l, "example.com", net.IPv4(1, 1, 1, 4), net.IPv4(2, 2, 2, 4))
<mask>
<mask> type tcAssertion struct {
<mask> num int
<mask> host string
<mask> answer, client net.IP
<mask> }
<mask>
<mask> testCases := []struct {
<mask> name string
<mask> sCr []searchCriterion
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove wantErr: ErrTSTooEarly,
</s> add wantErr: errTSTooEarly, </s> remove wantErr: ErrTSTooLate,
</s> add wantErr: errTSTooLate, </s> remove wantErr error
</s> add </s> remove want error
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlog_test.go |
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> )
<mask>
<mask> // Timestamp not found errors.
<mask> const (
<mask> ErrTSNotFound errors.Error = "ts not found"
<mask> ErrTSTooLate errors.Error = "ts too late"
<mask> ErrTSTooEarly errors.Error = "ts too early"
<mask> )
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove ErrTSNotFound errors.Error = "ts not found"
ErrTSTooLate errors.Error = "ts too late"
ErrTSTooEarly errors.Error = "ts too early"
</s> add // Timestamp not found errors.
errTSNotFound errors.Error = "ts not found"
errTSTooLate errors.Error = "ts too late"
errTSTooEarly errors.Error = "ts too early"
// maxEntrySize is a maximum size of the entry.
//
// TODO: Find a way to grow buffer instead of relying on this value when
// reading strings.
maxEntrySize = 16 * 1024
// bufferSize should be enough for at least this number of entries.
bufferSize = 100 * maxEntrySize </s> remove // TODO: Find a way to grow buffer instead of relying on this value when reading strings
const maxEntrySize = 16 * 1024
</s> add // qLogFile represents a single query log file. It allows reading from the
// file in the reverse order.
//
// Please note, that this is a stateful object. Internally, it contains a
// pointer to a specific position in the file, and it reads lines in reverse
// order starting from that position.
type qLogFile struct {
// file is the query log file.
file *os.File | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go | |
// Timestamp not found errors.
errTSNotFound errors.Error = "ts not found"
errTSTooLate errors.Error = "ts too late"
errTSTooEarly errors.Error = "ts too early"
// maxEntrySize is a maximum size of the entry.
//
// TODO: Find a way to grow buffer instead of relying on this value when
// reading strings.
maxEntrySize = 16 * 1024
// bufferSize should be enough for at least this number of entries.
bufferSize = 100 * maxEntrySize | <mask> )
<mask>
<mask> // Timestamp not found errors.
<mask> const (
<mask> ErrTSNotFound errors.Error = "ts not found"
<mask> ErrTSTooLate errors.Error = "ts too late"
<mask> ErrTSTooEarly errors.Error = "ts too early"
<mask> )
<mask>
<mask> // TODO: Find a way to grow buffer instead of relying on this value when reading strings
<mask> const maxEntrySize = 16 * 1024
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Timestamp not found errors.
</s> add </s> remove // TODO: Find a way to grow buffer instead of relying on this value when reading strings
const maxEntrySize = 16 * 1024
</s> add // qLogFile represents a single query log file. It allows reading from the
// file in the reverse order.
//
// Please note, that this is a stateful object. Internally, it contains a
// pointer to a specific position in the file, and it reads lines in reverse
// order starting from that position.
type qLogFile struct {
// file is the query log file.
file *os.File </s> remove // buffer should be enough for at least this number of entries
const bufferSize = 100 * maxEntrySize
</s> add // buffer that we've read from the file.
buffer []byte </s> remove const (
queryLogFileName = "querylog.json" // .gz added during compression
)
</s> add // queryLogFileName is a name of the log file. ".gz" extension is added later
// during compression.
const queryLogFileName = "querylog.json" </s> remove // queryLog is a structure that writes and reads the DNS query log
</s> add // queryLog is a structure that writes and reads the DNS query log. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// qLogFile represents a single query log file. It allows reading from the
// file in the reverse order.
//
// Please note, that this is a stateful object. Internally, it contains a
// pointer to a specific position in the file, and it reads lines in reverse
// order starting from that position.
type qLogFile struct {
// file is the query log file.
file *os.File | <mask> ErrTSTooLate errors.Error = "ts too late"
<mask> ErrTSTooEarly errors.Error = "ts too early"
<mask> )
<mask>
<mask> // TODO: Find a way to grow buffer instead of relying on this value when reading strings
<mask> const maxEntrySize = 16 * 1024
<mask>
<mask> // buffer should be enough for at least this number of entries
<mask> const bufferSize = 100 * maxEntrySize
<mask>
<mask> // QLogFile represents a single query log file
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove ErrTSNotFound errors.Error = "ts not found"
ErrTSTooLate errors.Error = "ts too late"
ErrTSTooEarly errors.Error = "ts too early"
</s> add // Timestamp not found errors.
errTSNotFound errors.Error = "ts not found"
errTSTooLate errors.Error = "ts too late"
errTSTooEarly errors.Error = "ts too early"
// maxEntrySize is a maximum size of the entry.
//
// TODO: Find a way to grow buffer instead of relying on this value when
// reading strings.
maxEntrySize = 16 * 1024
// bufferSize should be enough for at least this number of entries.
bufferSize = 100 * maxEntrySize </s> remove // buffer should be enough for at least this number of entries
const bufferSize = 100 * maxEntrySize
</s> add // buffer that we've read from the file.
buffer []byte </s> remove // Timestamp not found errors.
</s> add </s> remove // QLogFile represents a single query log file
// It allows reading from the file in the reverse order
//
// Please note that this is a stateful object.
// Internally, it contains a pointer to a specific position in the file,
// and it reads lines in reverse order starting from that position.
type QLogFile struct {
file *os.File // the query log file
position int64 // current position in the file
buffer []byte // buffer that we've read from the file
bufferStart int64 // start of the buffer (in the file)
bufferLen int // buffer len
lock sync.Mutex // We use mutex to make it thread-safe
</s> add // lock is a mutex to make it thread-safe.
lock sync.Mutex
// position is the position in the file.
position int64
// bufferStart is the start of the buffer (in the file).
bufferStart int64
// bufferLen is the length of the buffer.
bufferLen int </s> remove // readProbeLine reads a line that includes the specified position
// this method is supposed to be used when we use binary search in the Seek method
// in the case of consecutive reads, use readNext (it uses a better buffer)
func (q *QLogFile) readProbeLine(position int64) (string, int64, int64, error) {
// First of all, we should read a buffer that will include the query log line
// In order to do this, we'll define the boundaries
</s> add // readProbeLine reads a line that includes the specified position. This
// method is supposed to be used when we use binary search in the Seek method.
// In the case of consecutive reads, use readNext, cause it uses better buffer.
func (q *qLogFile) readProbeLine(position int64) (string, int64, int64, error) {
// First of all, we should read a buffer that will include the query log
// line. In order to do this, we'll define the boundaries. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// buffer that we've read from the file.
buffer []byte | <mask>
<mask> // TODO: Find a way to grow buffer instead of relying on this value when reading strings
<mask> const maxEntrySize = 16 * 1024
<mask>
<mask> // buffer should be enough for at least this number of entries
<mask> const bufferSize = 100 * maxEntrySize
<mask>
<mask> // QLogFile represents a single query log file
<mask> // It allows reading from the file in the reverse order
<mask> //
<mask> // Please note that this is a stateful object.
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // TODO: Find a way to grow buffer instead of relying on this value when reading strings
const maxEntrySize = 16 * 1024
</s> add // qLogFile represents a single query log file. It allows reading from the
// file in the reverse order.
//
// Please note, that this is a stateful object. Internally, it contains a
// pointer to a specific position in the file, and it reads lines in reverse
// order starting from that position.
type qLogFile struct {
// file is the query log file.
file *os.File </s> remove ErrTSNotFound errors.Error = "ts not found"
ErrTSTooLate errors.Error = "ts too late"
ErrTSTooEarly errors.Error = "ts too early"
</s> add // Timestamp not found errors.
errTSNotFound errors.Error = "ts not found"
errTSTooLate errors.Error = "ts too late"
errTSTooEarly errors.Error = "ts too early"
// maxEntrySize is a maximum size of the entry.
//
// TODO: Find a way to grow buffer instead of relying on this value when
// reading strings.
maxEntrySize = 16 * 1024
// bufferSize should be enough for at least this number of entries.
bufferSize = 100 * maxEntrySize </s> remove // QLogFile represents a single query log file
// It allows reading from the file in the reverse order
//
// Please note that this is a stateful object.
// Internally, it contains a pointer to a specific position in the file,
// and it reads lines in reverse order starting from that position.
type QLogFile struct {
file *os.File // the query log file
position int64 // current position in the file
buffer []byte // buffer that we've read from the file
bufferStart int64 // start of the buffer (in the file)
bufferLen int // buffer len
lock sync.Mutex // We use mutex to make it thread-safe
</s> add // lock is a mutex to make it thread-safe.
lock sync.Mutex
// position is the position in the file.
position int64
// bufferStart is the start of the buffer (in the file).
bufferStart int64
// bufferLen is the length of the buffer.
bufferLen int </s> remove // QLogReader allows reading from multiple query log files in the reverse order.
</s> add // qLogReader allows reading from multiple query log files in the reverse
// order. </s> remove // Please note that this is a stateful object.
// Internally, it contains a pointer to a particular query log file, and
// to a specific position in this file, and it reads lines in reverse order
// starting from that position.
type QLogReader struct {
// qFiles - array with the query log files
// The order is - from oldest to newest
qFiles []*QLogFile
currentFile int // Index of the current file
</s> add // Please note that this is a stateful object. Internally, it contains a
// pointer to a particular query log file, and to a specific position in this
// file, and it reads lines in reverse order starting from that position.
type qLogReader struct {
// qFiles is an array with the query log files. The order is from oldest
// to newest.
qFiles []*qLogFile
// currentFile is the index of the current file.
currentFile int | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// lock is a mutex to make it thread-safe.
lock sync.Mutex
// position is the position in the file.
position int64
// bufferStart is the start of the buffer (in the file).
bufferStart int64
// bufferLen is the length of the buffer.
bufferLen int | <mask>
<mask> // buffer should be enough for at least this number of entries
<mask> const bufferSize = 100 * maxEntrySize
<mask>
<mask> // QLogFile represents a single query log file
<mask> // It allows reading from the file in the reverse order
<mask> //
<mask> // Please note that this is a stateful object.
<mask> // Internally, it contains a pointer to a specific position in the file,
<mask> // and it reads lines in reverse order starting from that position.
<mask> type QLogFile struct {
<mask> file *os.File // the query log file
<mask> position int64 // current position in the file
<mask>
<mask> buffer []byte // buffer that we've read from the file
<mask> bufferStart int64 // start of the buffer (in the file)
<mask> bufferLen int // buffer len
<mask>
<mask> lock sync.Mutex // We use mutex to make it thread-safe
<mask> }
<mask>
<mask> // NewQLogFile initializes a new instance of the QLogFile
<mask> func NewQLogFile(path string) (*QLogFile, error) {
<mask> f, err := os.OpenFile(path, os.O_RDONLY, 0o644)
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // TODO: Find a way to grow buffer instead of relying on this value when reading strings
const maxEntrySize = 16 * 1024
</s> add // qLogFile represents a single query log file. It allows reading from the
// file in the reverse order.
//
// Please note, that this is a stateful object. Internally, it contains a
// pointer to a specific position in the file, and it reads lines in reverse
// order starting from that position.
type qLogFile struct {
// file is the query log file.
file *os.File </s> remove // buffer should be enough for at least this number of entries
const bufferSize = 100 * maxEntrySize
</s> add // buffer that we've read from the file.
buffer []byte </s> remove // Please note that this is a stateful object.
// Internally, it contains a pointer to a particular query log file, and
// to a specific position in this file, and it reads lines in reverse order
// starting from that position.
type QLogReader struct {
// qFiles - array with the query log files
// The order is - from oldest to newest
qFiles []*QLogFile
currentFile int // Index of the current file
</s> add // Please note that this is a stateful object. Internally, it contains a
// pointer to a particular query log file, and to a specific position in this
// file, and it reads lines in reverse order starting from that position.
type qLogReader struct {
// qFiles is an array with the query log files. The order is from oldest
// to newest.
qFiles []*qLogFile
// currentFile is the index of the current file.
currentFile int </s> remove // QLogReader allows reading from multiple query log files in the reverse order.
</s> add // qLogReader allows reading from multiple query log files in the reverse
// order. </s> remove // NewQLogFile initializes a new instance of the QLogFile
func NewQLogFile(path string) (*QLogFile, error) {
</s> add // newQLogFile initializes a new instance of the qLogFile.
func newQLogFile(path string) (qf *qLogFile, err error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// newQLogFile initializes a new instance of the qLogFile.
func newQLogFile(path string) (qf *qLogFile, err error) { | <mask>
<mask> lock sync.Mutex // We use mutex to make it thread-safe
<mask> }
<mask>
<mask> // NewQLogFile initializes a new instance of the QLogFile
<mask> func NewQLogFile(path string) (*QLogFile, error) {
<mask> f, err := os.OpenFile(path, os.O_RDONLY, 0o644)
<mask> if err != nil {
<mask> return nil, err
<mask> }
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // QLogFile represents a single query log file
// It allows reading from the file in the reverse order
//
// Please note that this is a stateful object.
// Internally, it contains a pointer to a specific position in the file,
// and it reads lines in reverse order starting from that position.
type QLogFile struct {
file *os.File // the query log file
position int64 // current position in the file
buffer []byte // buffer that we've read from the file
bufferStart int64 // start of the buffer (in the file)
bufferLen int // buffer len
lock sync.Mutex // We use mutex to make it thread-safe
</s> add // lock is a mutex to make it thread-safe.
lock sync.Mutex
// position is the position in the file.
position int64
// bufferStart is the start of the buffer (in the file).
bufferStart int64
// bufferLen is the length of the buffer.
bufferLen int </s> remove // NewQLogReader initializes a QLogReader instance
// with the specified files
func NewQLogReader(files []string) (*QLogReader, error) {
qFiles := make([]*QLogFile, 0)
</s> add // newQLogReader initializes a qLogReader instance with the specified files.
func newQLogReader(files []string) (*qLogReader, error) {
qFiles := make([]*qLogFile, 0) </s> remove // initBuffer initializes the QLogFile buffer.
// the goal is to read a chunk of file that includes the line with the specified position.
func (q *QLogFile) initBuffer(position int64) error {
</s> add // initBuffer initializes the qLogFile buffer. The goal is to read a chunk of
// file that includes the line with the specified position.
func (q *qLogFile) initBuffer(position int64) error { </s> remove return &QLogFile{
file: f,
}, nil
</s> add return &qLogFile{file: f}, nil
}
// validateQLogLineIdx returns error if the line index is not valid to continue
// search.
func (q *qLogFile) validateQLogLineIdx(lineIdx, lastProbeLineIdx, ts, fSize int64) (err error) {
if lineIdx == lastProbeLineIdx {
if lineIdx == 0 {
return errTSTooEarly
}
// If we're testing the same line twice then most likely the scope is
// too narrow and we won't find anything anymore in any other file.
return fmt.Errorf("looking up timestamp %d in %q: %w", ts, q.file.Name(), errTSNotFound)
} else if lineIdx == fSize {
return errTSTooLate
}
return nil | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
return &qLogFile{file: f}, nil
}
// validateQLogLineIdx returns error if the line index is not valid to continue
// search.
func (q *qLogFile) validateQLogLineIdx(lineIdx, lastProbeLineIdx, ts, fSize int64) (err error) {
if lineIdx == lastProbeLineIdx {
if lineIdx == 0 {
return errTSTooEarly
}
// If we're testing the same line twice then most likely the scope is
// too narrow and we won't find anything anymore in any other file.
return fmt.Errorf("looking up timestamp %d in %q: %w", ts, q.file.Name(), errTSNotFound)
} else if lineIdx == fSize {
return errTSTooLate
}
return nil | <mask> if err != nil {
<mask> return nil, err
<mask> }
<mask>
<mask> return &QLogFile{
<mask> file: f,
<mask> }, nil
<mask> }
<mask>
<mask> // seekTS performs binary search in the query log file looking for a record
<mask> // with the specified timestamp. Once the record is found, it sets
<mask> // "position" so that the next ReadNext call returned that record.
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // with the specified timestamp. Once the record is found, it sets
// "position" so that the next ReadNext call returned that record.
</s> add // with the specified timestamp. Once the record is found, it sets "position"
// so that the next ReadNext call returned that record. </s> remove return &QLogReader{
qFiles: qFiles,
currentFile: (len(qFiles) - 1),
}, nil
</s> add return &qLogReader{qFiles: qFiles, currentFile: len(qFiles) - 1}, nil </s> remove // timestamp. If the record is found, it sets QLogReader's position to point to
// that line, so that the next ReadNext call returned this line.
func (r *QLogReader) seekTS(timestamp int64) (err error) {
</s> add // timestamp. If the record is found, it sets qLogReader's position to point
// to that line, so that the next ReadNext call returned this line.
func (r *qLogReader) seekTS(timestamp int64) (err error) { </s> remove // 1. It starts with the position in the middle of a file
// 2. Shifts back to the beginning of the line
// 3. Checks the log record timestamp
// 4. If it is lower than the timestamp we are looking for,
// it shifts seek position to 3/4 of the file. Otherwise, to 1/4 of the file.
// 5. It performs the search again, every time the search scope is narrowed twice.
</s> add // 1. It starts with the position in the middle of a file.
// 2. Shifts back to the beginning of the line.
// 3. Checks the log record timestamp.
// 4. If it is lower than the timestamp we are looking for, it shifts seek
// position to 3/4 of the file. Otherwise, to 1/4 of the file.
// 5. It performs the search again, every time the search scope is narrowed
// twice. </s> remove // searchFiles looks up log records from all log files. It optionally uses the
// client cache, if provided. searchFiles does not scan more than
// maxFileScanEntries so callers may need to call it several times to get all
// results. oldest and total are the time of the oldest processed entry and the
// total number of processed entries, including discarded ones, correspondingly.
func (l *queryLog) searchFiles(
params *searchParams,
cache clientCache,
) (entries []*logEntry, oldest time.Time, total int) {
</s> add // seekRecord changes the current position to the next record older than the
// provided parameter.
func (r *qLogReader) seekRecord(olderThan time.Time) (err error) {
if olderThan.IsZero() {
return r.SeekStart()
}
err = r.seekTS(olderThan.UnixNano())
if err == nil {
// Read to the next record, because we only need the one that goes
// after it.
_, err = r.ReadNext()
}
return err
}
// setQLogReader creates a reader with the specified files and sets the
// position to the next record older than the provided parameter.
func (l *queryLog) setQLogReader(olderThan time.Time) (qr *qLogReader, err error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// with the specified timestamp. Once the record is found, it sets "position"
// so that the next ReadNext call returned that record. | <mask> }, nil
<mask> }
<mask>
<mask> // seekTS performs binary search in the query log file looking for a record
<mask> // with the specified timestamp. Once the record is found, it sets
<mask> // "position" so that the next ReadNext call returned that record.
<mask> //
<mask> // The algorithm is rather simple:
<mask> // 1. It starts with the position in the middle of a file
<mask> // 2. Shifts back to the beginning of the line
<mask> // 3. Checks the log record timestamp
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // 1. It starts with the position in the middle of a file
// 2. Shifts back to the beginning of the line
// 3. Checks the log record timestamp
// 4. If it is lower than the timestamp we are looking for,
// it shifts seek position to 3/4 of the file. Otherwise, to 1/4 of the file.
// 5. It performs the search again, every time the search scope is narrowed twice.
</s> add // 1. It starts with the position in the middle of a file.
// 2. Shifts back to the beginning of the line.
// 3. Checks the log record timestamp.
// 4. If it is lower than the timestamp we are looking for, it shifts seek
// position to 3/4 of the file. Otherwise, to 1/4 of the file.
// 5. It performs the search again, every time the search scope is narrowed
// twice. </s> remove return &QLogReader{
qFiles: qFiles,
currentFile: (len(qFiles) - 1),
}, nil
</s> add return &qLogReader{qFiles: qFiles, currentFile: len(qFiles) - 1}, nil </s> remove // timestamp. If the record is found, it sets QLogReader's position to point to
// that line, so that the next ReadNext call returned this line.
func (r *QLogReader) seekTS(timestamp int64) (err error) {
</s> add // timestamp. If the record is found, it sets qLogReader's position to point
// to that line, so that the next ReadNext call returned this line.
func (r *qLogReader) seekTS(timestamp int64) (err error) { </s> remove return &QLogFile{
file: f,
}, nil
</s> add return &qLogFile{file: f}, nil
}
// validateQLogLineIdx returns error if the line index is not valid to continue
// search.
func (q *qLogFile) validateQLogLineIdx(lineIdx, lastProbeLineIdx, ts, fSize int64) (err error) {
if lineIdx == lastProbeLineIdx {
if lineIdx == 0 {
return errTSTooEarly
}
// If we're testing the same line twice then most likely the scope is
// too narrow and we won't find anything anymore in any other file.
return fmt.Errorf("looking up timestamp %d in %q: %w", ts, q.file.Name(), errTSNotFound)
} else if lineIdx == fSize {
return errTSTooLate
}
return nil </s> remove // Please note that this is a stateful object.
// Internally, it contains a pointer to a particular query log file, and
// to a specific position in this file, and it reads lines in reverse order
// starting from that position.
type QLogReader struct {
// qFiles - array with the query log files
// The order is - from oldest to newest
qFiles []*QLogFile
currentFile int // Index of the current file
</s> add // Please note that this is a stateful object. Internally, it contains a
// pointer to a particular query log file, and to a specific position in this
// file, and it reads lines in reverse order starting from that position.
type qLogReader struct {
// qFiles is an array with the query log files. The order is from oldest
// to newest.
qFiles []*qLogFile
// currentFile is the index of the current file.
currentFile int | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// 1. It starts with the position in the middle of a file.
// 2. Shifts back to the beginning of the line.
// 3. Checks the log record timestamp.
// 4. If it is lower than the timestamp we are looking for, it shifts seek
// position to 3/4 of the file. Otherwise, to 1/4 of the file.
// 5. It performs the search again, every time the search scope is narrowed
// twice. | <mask> // with the specified timestamp. Once the record is found, it sets
<mask> // "position" so that the next ReadNext call returned that record.
<mask> //
<mask> // The algorithm is rather simple:
<mask> // 1. It starts with the position in the middle of a file
<mask> // 2. Shifts back to the beginning of the line
<mask> // 3. Checks the log record timestamp
<mask> // 4. If it is lower than the timestamp we are looking for,
<mask> // it shifts seek position to 3/4 of the file. Otherwise, to 1/4 of the file.
<mask> // 5. It performs the search again, every time the search scope is narrowed twice.
<mask> //
<mask> // Returns:
<mask> // * It returns the position of the the line with the timestamp we were looking for
<mask> // so that when we call "ReadNext" this line was returned.
<mask> // * Depth of the search (how many times we compared timestamps).
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // with the specified timestamp. Once the record is found, it sets
// "position" so that the next ReadNext call returned that record.
</s> add // with the specified timestamp. Once the record is found, it sets "position"
// so that the next ReadNext call returned that record. </s> remove // * It returns the position of the the line with the timestamp we were looking for
// so that when we call "ReadNext" this line was returned.
// * Depth of the search (how many times we compared timestamps).
// * If we could not find it, it returns one of the errors described above.
func (q *QLogFile) seekTS(timestamp int64) (int64, int, error) {
</s> add // - It returns the position of the line with the timestamp we were looking
// for so that when we call "ReadNext" this line was returned.
// - Depth of the search (how many times we compared timestamps).
// - If we could not find it, it returns one of the errors described above.
func (q *qLogFile) seekTS(timestamp int64) (pos int64, depth int, err error) { </s> remove // timestamp. If the record is found, it sets QLogReader's position to point to
// that line, so that the next ReadNext call returned this line.
func (r *QLogReader) seekTS(timestamp int64) (err error) {
</s> add // timestamp. If the record is found, it sets qLogReader's position to point
// to that line, so that the next ReadNext call returned this line.
func (r *qLogReader) seekTS(timestamp int64) (err error) { </s> remove return &QLogFile{
file: f,
}, nil
</s> add return &qLogFile{file: f}, nil
}
// validateQLogLineIdx returns error if the line index is not valid to continue
// search.
func (q *qLogFile) validateQLogLineIdx(lineIdx, lastProbeLineIdx, ts, fSize int64) (err error) {
if lineIdx == lastProbeLineIdx {
if lineIdx == 0 {
return errTSTooEarly
}
// If we're testing the same line twice then most likely the scope is
// too narrow and we won't find anything anymore in any other file.
return fmt.Errorf("looking up timestamp %d in %q: %w", ts, q.file.Name(), errTSNotFound)
} else if lineIdx == fSize {
return errTSTooLate
}
return nil </s> remove return &QLogReader{
qFiles: qFiles,
currentFile: (len(qFiles) - 1),
}, nil
</s> add return &qLogReader{qFiles: qFiles, currentFile: len(qFiles) - 1}, nil | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// - It returns the position of the line with the timestamp we were looking
// for so that when we call "ReadNext" this line was returned.
// - Depth of the search (how many times we compared timestamps).
// - If we could not find it, it returns one of the errors described above.
func (q *qLogFile) seekTS(timestamp int64) (pos int64, depth int, err error) { | <mask> // it shifts seek position to 3/4 of the file. Otherwise, to 1/4 of the file.
<mask> // 5. It performs the search again, every time the search scope is narrowed twice.
<mask> //
<mask> // Returns:
<mask> // * It returns the position of the the line with the timestamp we were looking for
<mask> // so that when we call "ReadNext" this line was returned.
<mask> // * Depth of the search (how many times we compared timestamps).
<mask> // * If we could not find it, it returns one of the errors described above.
<mask> func (q *QLogFile) seekTS(timestamp int64) (int64, int, error) {
<mask> q.lock.Lock()
<mask> defer q.lock.Unlock()
<mask>
<mask> // Empty the buffer
<mask> q.buffer = nil
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // 1. It starts with the position in the middle of a file
// 2. Shifts back to the beginning of the line
// 3. Checks the log record timestamp
// 4. If it is lower than the timestamp we are looking for,
// it shifts seek position to 3/4 of the file. Otherwise, to 1/4 of the file.
// 5. It performs the search again, every time the search scope is narrowed twice.
</s> add // 1. It starts with the position in the middle of a file.
// 2. Shifts back to the beginning of the line.
// 3. Checks the log record timestamp.
// 4. If it is lower than the timestamp we are looking for, it shifts seek
// position to 3/4 of the file. Otherwise, to 1/4 of the file.
// 5. It performs the search again, every time the search scope is narrowed
// twice. </s> remove // Empty the buffer
</s> add // Empty the buffer. </s> remove // Returns nil if we were able to change the current position.
// Returns error in any other case.
func (q *QLogFile) SeekStart() (int64, error) {
</s> add // Returns nil if we were able to change the current position. Returns error
// in any other case.
func (q *qLogFile) SeekStart() (int64, error) { </s> remove // the algorithm is:
// 1. check if we have the buffer initialized
// 2. if it is, scan it and look for the line there
// 3. if we cannot find the line there, read the prev chunk into the buffer
// 4. read the line from the buffer
func (q *QLogFile) readNextLine(position int64) (string, int64, error) {
</s> add // The algorithm is:
// 1. Check if we have the buffer initialized.
// 2. If it is so, scan it and look for the line there.
// 3. If we cannot find the line there, read the prev chunk into the buffer.
// 4. Read the line from the buffer.
func (q *qLogFile) readNextLine(position int64) (string, int64, error) { </s> remove // with the specified timestamp. Once the record is found, it sets
// "position" so that the next ReadNext call returned that record.
</s> add // with the specified timestamp. Once the record is found, it sets "position"
// so that the next ReadNext call returned that record. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Empty the buffer. | <mask> func (q *QLogFile) seekTS(timestamp int64) (int64, int, error) {
<mask> q.lock.Lock()
<mask> defer q.lock.Unlock()
<mask>
<mask> // Empty the buffer
<mask> q.buffer = nil
<mask>
<mask> // First of all, check the file size
<mask> fileInfo, err := q.file.Stat()
<mask> if err != nil {
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Empty the buffer
</s> add // Empty the buffer. </s> remove // First of all, check the file size
</s> add // First of all, check the file size. </s> remove // First of all, check the file size
</s> add // First of all, check the file size. </s> remove // Returns nil if we were able to change the current position.
// Returns error in any other case.
func (q *QLogFile) SeekStart() (int64, error) {
</s> add // Returns nil if we were able to change the current position. Returns error
// in any other case.
func (q *qLogFile) SeekStart() (int64, error) { </s> remove // * It returns the position of the the line with the timestamp we were looking for
// so that when we call "ReadNext" this line was returned.
// * Depth of the search (how many times we compared timestamps).
// * If we could not find it, it returns one of the errors described above.
func (q *QLogFile) seekTS(timestamp int64) (int64, int, error) {
</s> add // - It returns the position of the line with the timestamp we were looking
// for so that when we call "ReadNext" this line was returned.
// - Depth of the search (how many times we compared timestamps).
// - If we could not find it, it returns one of the errors described above.
func (q *qLogFile) seekTS(timestamp int64) (pos int64, depth int, err error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// First of all, check the file size. | <mask>
<mask> // Empty the buffer
<mask> q.buffer = nil
<mask>
<mask> // First of all, check the file size
<mask> fileInfo, err := q.file.Stat()
<mask> if err != nil {
<mask> return 0, 0, err
<mask> }
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // First of all, check the file size
</s> add // First of all, check the file size. </s> remove // Empty the buffer
</s> add // Empty the buffer. </s> remove // Empty the buffer
</s> add // Empty the buffer. </s> remove // The buffer size is 2*maxEntrySize
</s> add // The buffer size is 2*maxEntrySize. </s> remove // Time to re-init the buffer
</s> add // Time to re-init the buffer. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Define the search scope.
// Start of the search interval (position in the file).
start := int64(0)
// End of the search interval (position in the file).
end := fileInfo.Size()
// Probe is the approximate index of the line we'll try to check.
probe := (end - start) / 2
| <mask> if err != nil {
<mask> return 0, 0, err
<mask> }
<mask>
<mask> // Define the search scope
<mask> start := int64(0) // start of the search interval (position in the file)
<mask> end := fileInfo.Size() // end of the search interval (position in the file)
<mask> probe := (end - start) / 2 // probe -- approximate index of the line we'll try to check
<mask> var line string
<mask> var lineIdx int64 // index of the probe line in the file
<mask> var lineEndIdx int64
<mask> var lastProbeLineIdx int64 // index of the last probe line
<mask> lastProbeLineIdx = -1
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove var lineIdx int64 // index of the probe line in the file
</s> add // Index of the probe line in the file.
var lineIdx int64 </s> remove var lastProbeLineIdx int64 // index of the last probe line
</s> add // Index of the last probe line.
var lastProbeLineIdx int64 </s> remove // Count seek depth in order to detect mistakes
// If depth is too large, we should stop the search
depth := 0
</s> add // Count seek depth in order to detect mistakes. If depth is too large,
// we should stop the search. </s> remove if lineIdx == lastProbeLineIdx {
if lineIdx == 0 {
return 0, depth, ErrTSTooEarly
}
// If we're testing the same line twice then most likely
// the scope is too narrow and we won't find anything
// anymore in any other file.
return 0, depth, fmt.Errorf("looking up timestamp %d in %q: %w", timestamp, q.file.Name(), ErrTSNotFound)
} else if lineIdx == fileInfo.Size() {
return 0, depth, ErrTSTooLate
</s> add // Check if the line index if invalid.
err = q.validateQLogLineIdx(lineIdx, lastProbeLineIdx, timestamp, fileInfo.Size())
if err != nil {
return 0, depth, err </s> remove // If the timestamp we're looking for is OLDER than what we found
// Then the line is somewhere on the LEFT side from the current probe position
</s> add // If the timestamp we're looking for is OLDER than what we found,
// then the line is somewhere on the LEFT side from the current
// probe position. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Index of the probe line in the file.
var lineIdx int64 | <mask> start := int64(0) // start of the search interval (position in the file)
<mask> end := fileInfo.Size() // end of the search interval (position in the file)
<mask> probe := (end - start) / 2 // probe -- approximate index of the line we'll try to check
<mask> var line string
<mask> var lineIdx int64 // index of the probe line in the file
<mask> var lineEndIdx int64
<mask> var lastProbeLineIdx int64 // index of the last probe line
<mask> lastProbeLineIdx = -1
<mask>
<mask> // Count seek depth in order to detect mistakes
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Define the search scope
start := int64(0) // start of the search interval (position in the file)
end := fileInfo.Size() // end of the search interval (position in the file)
probe := (end - start) / 2 // probe -- approximate index of the line we'll try to check
</s> add // Define the search scope.
// Start of the search interval (position in the file).
start := int64(0)
// End of the search interval (position in the file).
end := fileInfo.Size()
// Probe is the approximate index of the line we'll try to check.
probe := (end - start) / 2
</s> remove var lastProbeLineIdx int64 // index of the last probe line
</s> add // Index of the last probe line.
var lastProbeLineIdx int64 </s> remove // Count seek depth in order to detect mistakes
// If depth is too large, we should stop the search
depth := 0
</s> add // Count seek depth in order to detect mistakes. If depth is too large,
// we should stop the search. </s> remove // If the timestamp we're looking for is NEWER than what we found
// Then the line is somewhere on the RIGHT side from the current probe position
</s> add // If the timestamp we're looking for is NEWER than what we found,
// then the line is somewhere on the RIGHT side from the current
// probe position. </s> remove // If the timestamp we're looking for is OLDER than what we found
// Then the line is somewhere on the LEFT side from the current probe position
</s> add // If the timestamp we're looking for is OLDER than what we found,
// then the line is somewhere on the LEFT side from the current
// probe position. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Index of the last probe line.
var lastProbeLineIdx int64 | <mask> probe := (end - start) / 2 // probe -- approximate index of the line we'll try to check
<mask> var line string
<mask> var lineIdx int64 // index of the probe line in the file
<mask> var lineEndIdx int64
<mask> var lastProbeLineIdx int64 // index of the last probe line
<mask> lastProbeLineIdx = -1
<mask>
<mask> // Count seek depth in order to detect mistakes
<mask> // If depth is too large, we should stop the search
<mask> depth := 0
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove var lineIdx int64 // index of the probe line in the file
</s> add // Index of the probe line in the file.
var lineIdx int64 </s> remove // Count seek depth in order to detect mistakes
// If depth is too large, we should stop the search
depth := 0
</s> add // Count seek depth in order to detect mistakes. If depth is too large,
// we should stop the search. </s> remove // Define the search scope
start := int64(0) // start of the search interval (position in the file)
end := fileInfo.Size() // end of the search interval (position in the file)
probe := (end - start) / 2 // probe -- approximate index of the line we'll try to check
</s> add // Define the search scope.
// Start of the search interval (position in the file).
start := int64(0)
// End of the search interval (position in the file).
end := fileInfo.Size()
// Probe is the approximate index of the line we'll try to check.
probe := (end - start) / 2
</s> remove // Get the line at the specified position
</s> add // Get the line at the specified position. </s> remove // If the timestamp we're looking for is NEWER than what we found
// Then the line is somewhere on the RIGHT side from the current probe position
</s> add // If the timestamp we're looking for is NEWER than what we found,
// then the line is somewhere on the RIGHT side from the current
// probe position. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Count seek depth in order to detect mistakes. If depth is too large,
// we should stop the search. | <mask> var lineEndIdx int64
<mask> var lastProbeLineIdx int64 // index of the last probe line
<mask> lastProbeLineIdx = -1
<mask>
<mask> // Count seek depth in order to detect mistakes
<mask> // If depth is too large, we should stop the search
<mask> depth := 0
<mask>
<mask> for {
<mask> // Get the line at the specified position
<mask> line, lineIdx, lineEndIdx, err = q.readProbeLine(probe)
<mask> if err != nil {
<mask> return 0, depth, err
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove var lastProbeLineIdx int64 // index of the last probe line
</s> add // Index of the last probe line.
var lastProbeLineIdx int64 </s> remove // Get the line at the specified position
</s> add // Get the line at the specified position. </s> remove var lineIdx int64 // index of the probe line in the file
</s> add // Index of the probe line in the file.
var lineIdx int64 </s> remove // Define the search scope
start := int64(0) // start of the search interval (position in the file)
end := fileInfo.Size() // end of the search interval (position in the file)
probe := (end - start) / 2 // probe -- approximate index of the line we'll try to check
</s> add // Define the search scope.
// Start of the search interval (position in the file).
start := int64(0)
// End of the search interval (position in the file).
end := fileInfo.Size()
// Probe is the approximate index of the line we'll try to check.
probe := (end - start) / 2
</s> remove if lineIdx == lastProbeLineIdx {
if lineIdx == 0 {
return 0, depth, ErrTSTooEarly
}
// If we're testing the same line twice then most likely
// the scope is too narrow and we won't find anything
// anymore in any other file.
return 0, depth, fmt.Errorf("looking up timestamp %d in %q: %w", timestamp, q.file.Name(), ErrTSNotFound)
} else if lineIdx == fileInfo.Size() {
return 0, depth, ErrTSTooLate
</s> add // Check if the line index if invalid.
err = q.validateQLogLineIdx(lineIdx, lastProbeLineIdx, timestamp, fileInfo.Size())
if err != nil {
return 0, depth, err | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Get the line at the specified position. | <mask> // If depth is too large, we should stop the search
<mask> depth := 0
<mask>
<mask> for {
<mask> // Get the line at the specified position
<mask> line, lineIdx, lineEndIdx, err = q.readProbeLine(probe)
<mask> if err != nil {
<mask> return 0, depth, err
<mask> }
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Count seek depth in order to detect mistakes
// If depth is too large, we should stop the search
depth := 0
</s> add // Count seek depth in order to detect mistakes. If depth is too large,
// we should stop the search. </s> remove var lastProbeLineIdx int64 // index of the last probe line
</s> add // Index of the last probe line.
var lastProbeLineIdx int64 </s> remove if lineIdx == lastProbeLineIdx {
if lineIdx == 0 {
return 0, depth, ErrTSTooEarly
}
// If we're testing the same line twice then most likely
// the scope is too narrow and we won't find anything
// anymore in any other file.
return 0, depth, fmt.Errorf("looking up timestamp %d in %q: %w", timestamp, q.file.Name(), ErrTSNotFound)
} else if lineIdx == fileInfo.Size() {
return 0, depth, ErrTSTooLate
</s> add // Check if the line index if invalid.
err = q.validateQLogLineIdx(lineIdx, lastProbeLineIdx, timestamp, fileInfo.Size())
if err != nil {
return 0, depth, err </s> remove // there's usually a line break before the line
// so we should shift one more char left from the line
// line\nline
</s> add // There's usually a line break before the line, so we should shift one
// more char left from the line "\nline". </s> remove return 0, depth, fmt.Errorf("looking up timestamp %d in %q: depth %d too high: %w", timestamp, q.file.Name(), depth, ErrTSNotFound)
</s> add return 0, depth, fmt.Errorf(
"looking up timestamp %d in %q: depth %d too high: %w",
timestamp,
q.file.Name(),
depth,
errTSNotFound,
) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Check if the line index if invalid.
err = q.validateQLogLineIdx(lineIdx, lastProbeLineIdx, timestamp, fileInfo.Size())
if err != nil {
return 0, depth, err | <mask> if err != nil {
<mask> return 0, depth, err
<mask> }
<mask>
<mask> if lineIdx == lastProbeLineIdx {
<mask> if lineIdx == 0 {
<mask> return 0, depth, ErrTSTooEarly
<mask> }
<mask>
<mask> // If we're testing the same line twice then most likely
<mask> // the scope is too narrow and we won't find anything
<mask> // anymore in any other file.
<mask> return 0, depth, fmt.Errorf("looking up timestamp %d in %q: %w", timestamp, q.file.Name(), ErrTSNotFound)
<mask> } else if lineIdx == fileInfo.Size() {
<mask> return 0, depth, ErrTSTooLate
<mask> }
<mask>
<mask> // Save the last found idx
<mask> lastProbeLineIdx = lineIdx
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Save the last found idx
</s> add // Save the last found idx. </s> remove return &QLogFile{
file: f,
}, nil
</s> add return &qLogFile{file: f}, nil
}
// validateQLogLineIdx returns error if the line index is not valid to continue
// search.
func (q *qLogFile) validateQLogLineIdx(lineIdx, lastProbeLineIdx, ts, fSize int64) (err error) {
if lineIdx == lastProbeLineIdx {
if lineIdx == 0 {
return errTSTooEarly
}
// If we're testing the same line twice then most likely the scope is
// too narrow and we won't find anything anymore in any other file.
return fmt.Errorf("looking up timestamp %d in %q: %w", ts, q.file.Name(), errTSNotFound)
} else if lineIdx == fSize {
return errTSTooLate
}
return nil </s> remove // Get the timestamp from the query log record
</s> add // Get the timestamp from the query log record. </s> remove return 0, depth, fmt.Errorf("looking up timestamp %d in %q: depth %d too high: %w", timestamp, q.file.Name(), depth, ErrTSNotFound)
</s> add return 0, depth, fmt.Errorf(
"looking up timestamp %d in %q: depth %d too high: %w",
timestamp,
q.file.Name(),
depth,
errTSNotFound,
) </s> remove return 0, depth, fmt.Errorf("looking up timestamp %d in %q: record %q has empty timestamp", timestamp, q.file.Name(), line)
</s> add return 0, depth, fmt.Errorf(
"looking up timestamp %d in %q: record %q has empty timestamp",
timestamp,
q.file.Name(),
line,
) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Save the last found idx. | <mask> } else if lineIdx == fileInfo.Size() {
<mask> return 0, depth, ErrTSTooLate
<mask> }
<mask>
<mask> // Save the last found idx
<mask> lastProbeLineIdx = lineIdx
<mask>
<mask> // Get the timestamp from the query log record
<mask> ts := readQLogTimestamp(line)
<mask> if ts == 0 {
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Get the timestamp from the query log record
</s> add // Get the timestamp from the query log record. </s> remove if lineIdx == lastProbeLineIdx {
if lineIdx == 0 {
return 0, depth, ErrTSTooEarly
}
// If we're testing the same line twice then most likely
// the scope is too narrow and we won't find anything
// anymore in any other file.
return 0, depth, fmt.Errorf("looking up timestamp %d in %q: %w", timestamp, q.file.Name(), ErrTSNotFound)
} else if lineIdx == fileInfo.Size() {
return 0, depth, ErrTSTooLate
</s> add // Check if the line index if invalid.
err = q.validateQLogLineIdx(lineIdx, lastProbeLineIdx, timestamp, fileInfo.Size())
if err != nil {
return 0, depth, err </s> remove return 0, depth, fmt.Errorf("looking up timestamp %d in %q: record %q has empty timestamp", timestamp, q.file.Name(), line)
</s> add return 0, depth, fmt.Errorf(
"looking up timestamp %d in %q: record %q has empty timestamp",
timestamp,
q.file.Name(),
line,
) </s> remove // Hurray, returning the result
</s> add // Hurray, returning the result. </s> remove return &QLogFile{
file: f,
}, nil
</s> add return &qLogFile{file: f}, nil
}
// validateQLogLineIdx returns error if the line index is not valid to continue
// search.
func (q *qLogFile) validateQLogLineIdx(lineIdx, lastProbeLineIdx, ts, fSize int64) (err error) {
if lineIdx == lastProbeLineIdx {
if lineIdx == 0 {
return errTSTooEarly
}
// If we're testing the same line twice then most likely the scope is
// too narrow and we won't find anything anymore in any other file.
return fmt.Errorf("looking up timestamp %d in %q: %w", ts, q.file.Name(), errTSNotFound)
} else if lineIdx == fSize {
return errTSTooLate
}
return nil | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Get the timestamp from the query log record. | <mask>
<mask> // Save the last found idx
<mask> lastProbeLineIdx = lineIdx
<mask>
<mask> // Get the timestamp from the query log record
<mask> ts := readQLogTimestamp(line)
<mask> if ts == 0 {
<mask> return 0, depth, fmt.Errorf("looking up timestamp %d in %q: record %q has empty timestamp", timestamp, q.file.Name(), line)
<mask> }
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove return 0, depth, fmt.Errorf("looking up timestamp %d in %q: record %q has empty timestamp", timestamp, q.file.Name(), line)
</s> add return 0, depth, fmt.Errorf(
"looking up timestamp %d in %q: record %q has empty timestamp",
timestamp,
q.file.Name(),
line,
) </s> remove // Hurray, returning the result
</s> add // Hurray, returning the result. </s> remove // Save the last found idx
</s> add // Save the last found idx. </s> remove if lineIdx == lastProbeLineIdx {
if lineIdx == 0 {
return 0, depth, ErrTSTooEarly
}
// If we're testing the same line twice then most likely
// the scope is too narrow and we won't find anything
// anymore in any other file.
return 0, depth, fmt.Errorf("looking up timestamp %d in %q: %w", timestamp, q.file.Name(), ErrTSNotFound)
} else if lineIdx == fileInfo.Size() {
return 0, depth, ErrTSTooLate
</s> add // Check if the line index if invalid.
err = q.validateQLogLineIdx(lineIdx, lastProbeLineIdx, timestamp, fileInfo.Size())
if err != nil {
return 0, depth, err </s> remove return 0, depth, fmt.Errorf("looking up timestamp %d in %q: depth %d too high: %w", timestamp, q.file.Name(), depth, ErrTSNotFound)
</s> add return 0, depth, fmt.Errorf(
"looking up timestamp %d in %q: depth %d too high: %w",
timestamp,
q.file.Name(),
depth,
errTSNotFound,
) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
return 0, depth, fmt.Errorf(
"looking up timestamp %d in %q: record %q has empty timestamp",
timestamp,
q.file.Name(),
line,
) | <mask>
<mask> // Get the timestamp from the query log record
<mask> ts := readQLogTimestamp(line)
<mask> if ts == 0 {
<mask> return 0, depth, fmt.Errorf("looking up timestamp %d in %q: record %q has empty timestamp", timestamp, q.file.Name(), line)
<mask> }
<mask>
<mask> if ts == timestamp {
<mask> // Hurray, returning the result
<mask> break
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Hurray, returning the result
</s> add // Hurray, returning the result. </s> remove // Get the timestamp from the query log record
</s> add // Get the timestamp from the query log record. </s> remove // Save the last found idx
</s> add // Save the last found idx. </s> remove if lineIdx == lastProbeLineIdx {
if lineIdx == 0 {
return 0, depth, ErrTSTooEarly
}
// If we're testing the same line twice then most likely
// the scope is too narrow and we won't find anything
// anymore in any other file.
return 0, depth, fmt.Errorf("looking up timestamp %d in %q: %w", timestamp, q.file.Name(), ErrTSNotFound)
} else if lineIdx == fileInfo.Size() {
return 0, depth, ErrTSTooLate
</s> add // Check if the line index if invalid.
err = q.validateQLogLineIdx(lineIdx, lastProbeLineIdx, timestamp, fileInfo.Size())
if err != nil {
return 0, depth, err </s> remove return 0, depth, fmt.Errorf("looking up timestamp %d in %q: depth %d too high: %w", timestamp, q.file.Name(), depth, ErrTSNotFound)
</s> add return 0, depth, fmt.Errorf(
"looking up timestamp %d in %q: depth %d too high: %w",
timestamp,
q.file.Name(),
depth,
errTSNotFound,
) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Hurray, returning the result. | <mask> return 0, depth, fmt.Errorf("looking up timestamp %d in %q: record %q has empty timestamp", timestamp, q.file.Name(), line)
<mask> }
<mask>
<mask> if ts == timestamp {
<mask> // Hurray, returning the result
<mask> break
<mask> }
<mask>
<mask> // Narrow the scope and repeat the search
<mask> if ts > timestamp {
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove return 0, depth, fmt.Errorf("looking up timestamp %d in %q: record %q has empty timestamp", timestamp, q.file.Name(), line)
</s> add return 0, depth, fmt.Errorf(
"looking up timestamp %d in %q: record %q has empty timestamp",
timestamp,
q.file.Name(),
line,
) </s> remove // Get the timestamp from the query log record
</s> add // Get the timestamp from the query log record. </s> remove // Narrow the scope and repeat the search
</s> add // Narrow the scope and repeat the search. </s> remove return 0, depth, fmt.Errorf("looking up timestamp %d in %q: depth %d too high: %w", timestamp, q.file.Name(), depth, ErrTSNotFound)
</s> add return 0, depth, fmt.Errorf(
"looking up timestamp %d in %q: depth %d too high: %w",
timestamp,
q.file.Name(),
depth,
errTSNotFound,
) </s> remove if lineIdx == lastProbeLineIdx {
if lineIdx == 0 {
return 0, depth, ErrTSTooEarly
}
// If we're testing the same line twice then most likely
// the scope is too narrow and we won't find anything
// anymore in any other file.
return 0, depth, fmt.Errorf("looking up timestamp %d in %q: %w", timestamp, q.file.Name(), ErrTSNotFound)
} else if lineIdx == fileInfo.Size() {
return 0, depth, ErrTSTooLate
</s> add // Check if the line index if invalid.
err = q.validateQLogLineIdx(lineIdx, lastProbeLineIdx, timestamp, fileInfo.Size())
if err != nil {
return 0, depth, err | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Narrow the scope and repeat the search. | <mask> // Hurray, returning the result
<mask> break
<mask> }
<mask>
<mask> // Narrow the scope and repeat the search
<mask> if ts > timestamp {
<mask> // If the timestamp we're looking for is OLDER than what we found
<mask> // Then the line is somewhere on the LEFT side from the current probe position
<mask> end = lineIdx
<mask> } else {
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // If the timestamp we're looking for is OLDER than what we found
// Then the line is somewhere on the LEFT side from the current probe position
</s> add // If the timestamp we're looking for is OLDER than what we found,
// then the line is somewhere on the LEFT side from the current
// probe position. </s> remove // If the timestamp we're looking for is NEWER than what we found
// Then the line is somewhere on the RIGHT side from the current probe position
</s> add // If the timestamp we're looking for is NEWER than what we found,
// then the line is somewhere on the RIGHT side from the current
// probe position. </s> remove // Hurray, returning the result
</s> add // Hurray, returning the result. </s> remove // Save the last found idx
</s> add // Save the last found idx. </s> remove return 0, depth, fmt.Errorf("looking up timestamp %d in %q: record %q has empty timestamp", timestamp, q.file.Name(), line)
</s> add return 0, depth, fmt.Errorf(
"looking up timestamp %d in %q: record %q has empty timestamp",
timestamp,
q.file.Name(),
line,
) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// If the timestamp we're looking for is OLDER than what we found,
// then the line is somewhere on the LEFT side from the current
// probe position. | <mask> }
<mask>
<mask> // Narrow the scope and repeat the search
<mask> if ts > timestamp {
<mask> // If the timestamp we're looking for is OLDER than what we found
<mask> // Then the line is somewhere on the LEFT side from the current probe position
<mask> end = lineIdx
<mask> } else {
<mask> // If the timestamp we're looking for is NEWER than what we found
<mask> // Then the line is somewhere on the RIGHT side from the current probe position
<mask> start = lineEndIdx
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // If the timestamp we're looking for is NEWER than what we found
// Then the line is somewhere on the RIGHT side from the current probe position
</s> add // If the timestamp we're looking for is NEWER than what we found,
// then the line is somewhere on the RIGHT side from the current
// probe position. </s> remove // Narrow the scope and repeat the search
</s> add // Narrow the scope and repeat the search. </s> remove // 1. It starts with the position in the middle of a file
// 2. Shifts back to the beginning of the line
// 3. Checks the log record timestamp
// 4. If it is lower than the timestamp we are looking for,
// it shifts seek position to 3/4 of the file. Otherwise, to 1/4 of the file.
// 5. It performs the search again, every time the search scope is narrowed twice.
</s> add // 1. It starts with the position in the middle of a file.
// 2. Shifts back to the beginning of the line.
// 3. Checks the log record timestamp.
// 4. If it is lower than the timestamp we are looking for, it shifts seek
// position to 3/4 of the file. Otherwise, to 1/4 of the file.
// 5. It performs the search again, every time the search scope is narrowed
// twice. </s> remove // Hurray, returning the result
</s> add // Hurray, returning the result. </s> remove // Save the last found idx
</s> add // Save the last found idx. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// If the timestamp we're looking for is NEWER than what we found,
// then the line is somewhere on the RIGHT side from the current
// probe position. | <mask> // If the timestamp we're looking for is OLDER than what we found
<mask> // Then the line is somewhere on the LEFT side from the current probe position
<mask> end = lineIdx
<mask> } else {
<mask> // If the timestamp we're looking for is NEWER than what we found
<mask> // Then the line is somewhere on the RIGHT side from the current probe position
<mask> start = lineEndIdx
<mask> }
<mask> probe = start + (end-start)/2
<mask>
<mask> depth++
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // If the timestamp we're looking for is OLDER than what we found
// Then the line is somewhere on the LEFT side from the current probe position
</s> add // If the timestamp we're looking for is OLDER than what we found,
// then the line is somewhere on the LEFT side from the current
// probe position. </s> remove // Narrow the scope and repeat the search
</s> add // Narrow the scope and repeat the search. </s> remove var lineIdx int64 // index of the probe line in the file
</s> add // Index of the probe line in the file.
var lineIdx int64 </s> remove // SeekStart changes the current position to the end of the file
// Please note that we're reading query log in the reverse order
// and that's why log start is actually the end of file
</s> add // SeekStart changes the current position to the end of the file. Please note,
// that we're reading query log in the reverse order and that's why log start
// is actually the end of file. </s> remove // Define the search scope
start := int64(0) // start of the search interval (position in the file)
end := fileInfo.Size() // end of the search interval (position in the file)
probe := (end - start) / 2 // probe -- approximate index of the line we'll try to check
</s> add // Define the search scope.
// Start of the search interval (position in the file).
start := int64(0)
// End of the search interval (position in the file).
end := fileInfo.Size()
// Probe is the approximate index of the line we'll try to check.
probe := (end - start) / 2
| [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
return 0, depth, fmt.Errorf(
"looking up timestamp %d in %q: depth %d too high: %w",
timestamp,
q.file.Name(),
depth,
errTSNotFound,
) | <mask> probe = start + (end-start)/2
<mask>
<mask> depth++
<mask> if depth >= 100 {
<mask> return 0, depth, fmt.Errorf("looking up timestamp %d in %q: depth %d too high: %w", timestamp, q.file.Name(), depth, ErrTSNotFound)
<mask> }
<mask> }
<mask>
<mask> q.position = lineIdx + int64(len(line))
<mask> return q.position, depth, nil
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove if lineIdx == lastProbeLineIdx {
if lineIdx == 0 {
return 0, depth, ErrTSTooEarly
}
// If we're testing the same line twice then most likely
// the scope is too narrow and we won't find anything
// anymore in any other file.
return 0, depth, fmt.Errorf("looking up timestamp %d in %q: %w", timestamp, q.file.Name(), ErrTSNotFound)
} else if lineIdx == fileInfo.Size() {
return 0, depth, ErrTSTooLate
</s> add // Check if the line index if invalid.
err = q.validateQLogLineIdx(lineIdx, lastProbeLineIdx, timestamp, fileInfo.Size())
if err != nil {
return 0, depth, err </s> remove return 0, depth, fmt.Errorf("looking up timestamp %d in %q: record %q has empty timestamp", timestamp, q.file.Name(), line)
</s> add return 0, depth, fmt.Errorf(
"looking up timestamp %d in %q: record %q has empty timestamp",
timestamp,
q.file.Name(),
line,
) </s> remove // Hurray, returning the result
</s> add // Hurray, returning the result. </s> remove // Get the timestamp from the query log record
</s> add // Get the timestamp from the query log record. </s> remove // Count seek depth in order to detect mistakes
// If depth is too large, we should stop the search
depth := 0
</s> add // Count seek depth in order to detect mistakes. If depth is too large,
// we should stop the search. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// SeekStart changes the current position to the end of the file. Please note,
// that we're reading query log in the reverse order and that's why log start
// is actually the end of file. | <mask> q.position = lineIdx + int64(len(line))
<mask> return q.position, depth, nil
<mask> }
<mask>
<mask> // SeekStart changes the current position to the end of the file
<mask> // Please note that we're reading query log in the reverse order
<mask> // and that's why log start is actually the end of file
<mask> //
<mask> // Returns nil if we were able to change the current position.
<mask> // Returns error in any other case.
<mask> func (q *QLogFile) SeekStart() (int64, error) {
<mask> q.lock.Lock()
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Returns nil if we were able to change the current position.
// Returns error in any other case.
func (q *QLogFile) SeekStart() (int64, error) {
</s> add // Returns nil if we were able to change the current position. Returns error
// in any other case.
func (q *qLogFile) SeekStart() (int64, error) { </s> remove // SeekStart changes the current position to the end of the newest file
// Please note that we're reading query log in the reverse order
// and that's why log start is actually the end of file
</s> add // SeekStart changes the current position to the end of the newest file.
// Please note that we're reading query log in the reverse order and that's why
// the log starts actually at the end of file. </s> remove // Returns nil if we were able to change the current position.
// Returns error in any other case.
func (r *QLogReader) SeekStart() error {
</s> add // Returns nil if we were able to change the current position. Returns error
// in any other cases.
func (r *qLogReader) SeekStart() error { </s> remove // ReadNext reads the next line (in the reverse order) from the file
// and shifts the current position left to the next (actually prev) line.
// returns io.EOF if there's nothing to read more
func (q *QLogFile) ReadNext() (string, error) {
</s> add // ReadNext reads the next line (in the reverse order) from the file and shifts
// the current position left to the next (actually prev) line.
//
// Returns io.EOF if there's nothing more to read.
func (q *qLogFile) ReadNext() (string, error) { </s> remove // Please note that this is a stateful object.
// Internally, it contains a pointer to a particular query log file, and
// to a specific position in this file, and it reads lines in reverse order
// starting from that position.
type QLogReader struct {
// qFiles - array with the query log files
// The order is - from oldest to newest
qFiles []*QLogFile
currentFile int // Index of the current file
</s> add // Please note that this is a stateful object. Internally, it contains a
// pointer to a particular query log file, and to a specific position in this
// file, and it reads lines in reverse order starting from that position.
type qLogReader struct {
// qFiles is an array with the query log files. The order is from oldest
// to newest.
qFiles []*qLogFile
// currentFile is the index of the current file.
currentFile int | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Returns nil if we were able to change the current position. Returns error
// in any other case.
func (q *qLogFile) SeekStart() (int64, error) { | <mask> // SeekStart changes the current position to the end of the file
<mask> // Please note that we're reading query log in the reverse order
<mask> // and that's why log start is actually the end of file
<mask> //
<mask> // Returns nil if we were able to change the current position.
<mask> // Returns error in any other case.
<mask> func (q *QLogFile) SeekStart() (int64, error) {
<mask> q.lock.Lock()
<mask> defer q.lock.Unlock()
<mask>
<mask> // Empty the buffer
<mask> q.buffer = nil
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // SeekStart changes the current position to the end of the file
// Please note that we're reading query log in the reverse order
// and that's why log start is actually the end of file
</s> add // SeekStart changes the current position to the end of the file. Please note,
// that we're reading query log in the reverse order and that's why log start
// is actually the end of file. </s> remove // SeekStart changes the current position to the end of the newest file
// Please note that we're reading query log in the reverse order
// and that's why log start is actually the end of file
</s> add // SeekStart changes the current position to the end of the newest file.
// Please note that we're reading query log in the reverse order and that's why
// the log starts actually at the end of file. </s> remove // Returns nil if we were able to change the current position.
// Returns error in any other case.
func (r *QLogReader) SeekStart() error {
</s> add // Returns nil if we were able to change the current position. Returns error
// in any other cases.
func (r *qLogReader) SeekStart() error { </s> remove // Empty the buffer
</s> add // Empty the buffer. </s> remove // Empty the buffer
</s> add // Empty the buffer. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Empty the buffer. | <mask> func (q *QLogFile) SeekStart() (int64, error) {
<mask> q.lock.Lock()
<mask> defer q.lock.Unlock()
<mask>
<mask> // Empty the buffer
<mask> q.buffer = nil
<mask>
<mask> // First of all, check the file size
<mask> fileInfo, err := q.file.Stat()
<mask> if err != nil {
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Empty the buffer
</s> add // Empty the buffer. </s> remove // First of all, check the file size
</s> add // First of all, check the file size. </s> remove // First of all, check the file size
</s> add // First of all, check the file size. </s> remove // Returns nil if we were able to change the current position.
// Returns error in any other case.
func (q *QLogFile) SeekStart() (int64, error) {
</s> add // Returns nil if we were able to change the current position. Returns error
// in any other case.
func (q *qLogFile) SeekStart() (int64, error) { </s> remove // ReadNext reads the next line (in the reverse order) from the file
// and shifts the current position left to the next (actually prev) line.
// returns io.EOF if there's nothing to read more
func (q *QLogFile) ReadNext() (string, error) {
</s> add // ReadNext reads the next line (in the reverse order) from the file and shifts
// the current position left to the next (actually prev) line.
//
// Returns io.EOF if there's nothing more to read.
func (q *qLogFile) ReadNext() (string, error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// First of all, check the file size. | <mask>
<mask> // Empty the buffer
<mask> q.buffer = nil
<mask>
<mask> // First of all, check the file size
<mask> fileInfo, err := q.file.Stat()
<mask> if err != nil {
<mask> return 0, err
<mask> }
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // First of all, check the file size
</s> add // First of all, check the file size. </s> remove // Empty the buffer
</s> add // Empty the buffer. </s> remove // Empty the buffer
</s> add // Empty the buffer. </s> remove // The buffer size is 2*maxEntrySize
</s> add // The buffer size is 2*maxEntrySize. </s> remove // Time to re-init the buffer
</s> add // Time to re-init the buffer. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Place the position to the very end of file. | <mask> if err != nil {
<mask> return 0, err
<mask> }
<mask>
<mask> // Place the position to the very end of file
<mask> q.position = fileInfo.Size() - 1
<mask> if q.position < 0 {
<mask> q.position = 0
<mask> }
<mask> return q.position, nil
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // there's usually a line break before the line
// so we should shift one more char left from the line
// line\nline
</s> add // There's usually a line break before the line, so we should shift one
// more char left from the line "\nline". </s> remove // Shift position
</s> add // Shift position. </s> remove // ReadNext reads the next line (in the reverse order) from the file
// and shifts the current position left to the next (actually prev) line.
// returns io.EOF if there's nothing to read more
func (q *QLogFile) ReadNext() (string, error) {
</s> add // ReadNext reads the next line (in the reverse order) from the file and shifts
// the current position left to the next (actually prev) line.
//
// Returns io.EOF if there's nothing more to read.
func (q *qLogFile) ReadNext() (string, error) { </s> remove // SeekStart changes the current position to the end of the file
// Please note that we're reading query log in the reverse order
// and that's why log start is actually the end of file
</s> add // SeekStart changes the current position to the end of the file. Please note,
// that we're reading query log in the reverse order and that's why log start
// is actually the end of file. </s> remove if lineIdx == lastProbeLineIdx {
if lineIdx == 0 {
return 0, depth, ErrTSTooEarly
}
// If we're testing the same line twice then most likely
// the scope is too narrow and we won't find anything
// anymore in any other file.
return 0, depth, fmt.Errorf("looking up timestamp %d in %q: %w", timestamp, q.file.Name(), ErrTSNotFound)
} else if lineIdx == fileInfo.Size() {
return 0, depth, ErrTSTooLate
</s> add // Check if the line index if invalid.
err = q.validateQLogLineIdx(lineIdx, lastProbeLineIdx, timestamp, fileInfo.Size())
if err != nil {
return 0, depth, err | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// ReadNext reads the next line (in the reverse order) from the file and shifts
// the current position left to the next (actually prev) line.
//
// Returns io.EOF if there's nothing more to read.
func (q *qLogFile) ReadNext() (string, error) { | <mask> }
<mask> return q.position, nil
<mask> }
<mask>
<mask> // ReadNext reads the next line (in the reverse order) from the file
<mask> // and shifts the current position left to the next (actually prev) line.
<mask> // returns io.EOF if there's nothing to read more
<mask> func (q *QLogFile) ReadNext() (string, error) {
<mask> q.lock.Lock()
<mask> defer q.lock.Unlock()
<mask>
<mask> if q.position == 0 {
<mask> return "", io.EOF
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // ReadNext reads the next line (in the reverse order) from the query log files.
// and shifts the current position left to the next (actually prev) line (or the next file).
// returns io.EOF if there's nothing to read more.
func (r *QLogReader) ReadNext() (string, error) {
</s> add // ReadNext reads the next line (in the reverse order) from the query log
// files. Then shifts the current position left to the next (actually prev)
// line (or the next file).
//
// Returns io.EOF if there is nothing more to read.
func (r *qLogReader) ReadNext() (string, error) { </s> remove // Shift position
</s> add // Shift position. </s> remove // there's usually a line break before the line
// so we should shift one more char left from the line
// line\nline
</s> add // There's usually a line break before the line, so we should shift one
// more char left from the line "\nline". </s> remove // SeekStart changes the current position to the end of the file
// Please note that we're reading query log in the reverse order
// and that's why log start is actually the end of file
</s> add // SeekStart changes the current position to the end of the file. Please note,
// that we're reading query log in the reverse order and that's why log start
// is actually the end of file. </s> remove // Time to re-init the buffer
</s> add // Time to re-init the buffer. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Shift position. | <mask> if err != nil {
<mask> return "", err
<mask> }
<mask>
<mask> // Shift position
<mask> if lineIdx == 0 {
<mask> q.position = 0
<mask> } else {
<mask> // there's usually a line break before the line
<mask> // so we should shift one more char left from the line
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // there's usually a line break before the line
// so we should shift one more char left from the line
// line\nline
</s> add // There's usually a line break before the line, so we should shift one
// more char left from the line "\nline". </s> remove // ReadNext reads the next line (in the reverse order) from the file
// and shifts the current position left to the next (actually prev) line.
// returns io.EOF if there's nothing to read more
func (q *QLogFile) ReadNext() (string, error) {
</s> add // ReadNext reads the next line (in the reverse order) from the file and shifts
// the current position left to the next (actually prev) line.
//
// Returns io.EOF if there's nothing more to read.
func (q *qLogFile) ReadNext() (string, error) { </s> remove // ReadNext reads the next line (in the reverse order) from the query log files.
// and shifts the current position left to the next (actually prev) line (or the next file).
// returns io.EOF if there's nothing to read more.
func (r *QLogReader) ReadNext() (string, error) {
</s> add // ReadNext reads the next line (in the reverse order) from the query log
// files. Then shifts the current position left to the next (actually prev)
// line (or the next file).
//
// Returns io.EOF if there is nothing more to read.
func (r *qLogReader) ReadNext() (string, error) { </s> remove if lineIdx == lastProbeLineIdx {
if lineIdx == 0 {
return 0, depth, ErrTSTooEarly
}
// If we're testing the same line twice then most likely
// the scope is too narrow and we won't find anything
// anymore in any other file.
return 0, depth, fmt.Errorf("looking up timestamp %d in %q: %w", timestamp, q.file.Name(), ErrTSNotFound)
} else if lineIdx == fileInfo.Size() {
return 0, depth, ErrTSTooLate
</s> add // Check if the line index if invalid.
err = q.validateQLogLineIdx(lineIdx, lastProbeLineIdx, timestamp, fileInfo.Size())
if err != nil {
return 0, depth, err </s> remove // Now start looking for the new line character starting
// from the relativePos and going left
</s> add // Now start looking for the new line character starting from the
// relativePos and going left. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// There's usually a line break before the line, so we should shift one
// more char left from the line "\nline". | <mask> // Shift position
<mask> if lineIdx == 0 {
<mask> q.position = 0
<mask> } else {
<mask> // there's usually a line break before the line
<mask> // so we should shift one more char left from the line
<mask> // line\nline
<mask> q.position = lineIdx - 1
<mask> }
<mask> return line, err
<mask> }
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Shift position
</s> add // Shift position. </s> remove // ReadNext reads the next line (in the reverse order) from the file
// and shifts the current position left to the next (actually prev) line.
// returns io.EOF if there's nothing to read more
func (q *QLogFile) ReadNext() (string, error) {
</s> add // ReadNext reads the next line (in the reverse order) from the file and shifts
// the current position left to the next (actually prev) line.
//
// Returns io.EOF if there's nothing more to read.
func (q *qLogFile) ReadNext() (string, error) { </s> remove // Place the position to the very end of file
</s> add // Place the position to the very end of file. </s> remove // ReadNext reads the next line (in the reverse order) from the query log files.
// and shifts the current position left to the next (actually prev) line (or the next file).
// returns io.EOF if there's nothing to read more.
func (r *QLogReader) ReadNext() (string, error) {
</s> add // ReadNext reads the next line (in the reverse order) from the query log
// files. Then shifts the current position left to the next (actually prev)
// line (or the next file).
//
// Returns io.EOF if there is nothing more to read.
func (r *qLogReader) ReadNext() (string, error) { </s> remove if lineIdx == lastProbeLineIdx {
if lineIdx == 0 {
return 0, depth, ErrTSTooEarly
}
// If we're testing the same line twice then most likely
// the scope is too narrow and we won't find anything
// anymore in any other file.
return 0, depth, fmt.Errorf("looking up timestamp %d in %q: %w", timestamp, q.file.Name(), ErrTSNotFound)
} else if lineIdx == fileInfo.Size() {
return 0, depth, ErrTSTooLate
</s> add // Check if the line index if invalid.
err = q.validateQLogLineIdx(lineIdx, lastProbeLineIdx, timestamp, fileInfo.Size())
if err != nil {
return 0, depth, err | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Close frees the underlying resources.
func (q *qLogFile) Close() error { | <mask> }
<mask> return line, err
<mask> }
<mask>
<mask> // Close frees the underlying resources
<mask> func (q *QLogFile) Close() error {
<mask> return q.file.Close()
<mask> }
<mask>
<mask> // readNextLine reads the next line from the specified position
<mask> // this line actually have to END on that position.
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // readNextLine reads the next line from the specified position
// this line actually have to END on that position.
</s> add // readNextLine reads the next line from the specified position. This line
// actually have to END on that position. </s> remove // the algorithm is:
// 1. check if we have the buffer initialized
// 2. if it is, scan it and look for the line there
// 3. if we cannot find the line there, read the prev chunk into the buffer
// 4. read the line from the buffer
func (q *QLogFile) readNextLine(position int64) (string, int64, error) {
</s> add // The algorithm is:
// 1. Check if we have the buffer initialized.
// 2. If it is so, scan it and look for the line there.
// 3. If we cannot find the line there, read the prev chunk into the buffer.
// 4. Read the line from the buffer.
func (q *qLogFile) readNextLine(position int64) (string, int64, error) { </s> remove // initBuffer initializes the QLogFile buffer.
// the goal is to read a chunk of file that includes the line with the specified position.
func (q *QLogFile) initBuffer(position int64) error {
</s> add // initBuffer initializes the qLogFile buffer. The goal is to read a chunk of
// file that includes the line with the specified position.
func (q *qLogFile) initBuffer(position int64) error { </s> remove // ReadNext reads the next line (in the reverse order) from the file
// and shifts the current position left to the next (actually prev) line.
// returns io.EOF if there's nothing to read more
func (q *QLogFile) ReadNext() (string, error) {
</s> add // ReadNext reads the next line (in the reverse order) from the file and shifts
// the current position left to the next (actually prev) line.
//
// Returns io.EOF if there's nothing more to read.
func (q *qLogFile) ReadNext() (string, error) { </s> remove // Nothing to read anymore
</s> add // Nothing to read anymore. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// readNextLine reads the next line from the specified position. This line
// actually have to END on that position. | <mask> func (q *QLogFile) Close() error {
<mask> return q.file.Close()
<mask> }
<mask>
<mask> // readNextLine reads the next line from the specified position
<mask> // this line actually have to END on that position.
<mask> //
<mask> // the algorithm is:
<mask> // 1. check if we have the buffer initialized
<mask> // 2. if it is, scan it and look for the line there
<mask> // 3. if we cannot find the line there, read the prev chunk into the buffer
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // the algorithm is:
// 1. check if we have the buffer initialized
// 2. if it is, scan it and look for the line there
// 3. if we cannot find the line there, read the prev chunk into the buffer
// 4. read the line from the buffer
func (q *QLogFile) readNextLine(position int64) (string, int64, error) {
</s> add // The algorithm is:
// 1. Check if we have the buffer initialized.
// 2. If it is so, scan it and look for the line there.
// 3. If we cannot find the line there, read the prev chunk into the buffer.
// 4. Read the line from the buffer.
func (q *qLogFile) readNextLine(position int64) (string, int64, error) { </s> remove // Close frees the underlying resources
func (q *QLogFile) Close() error {
</s> add // Close frees the underlying resources.
func (q *qLogFile) Close() error { </s> remove // initBuffer initializes the QLogFile buffer.
// the goal is to read a chunk of file that includes the line with the specified position.
func (q *QLogFile) initBuffer(position int64) error {
</s> add // initBuffer initializes the qLogFile buffer. The goal is to read a chunk of
// file that includes the line with the specified position.
func (q *qLogFile) initBuffer(position int64) error { </s> remove // readProbeLine reads a line that includes the specified position
// this method is supposed to be used when we use binary search in the Seek method
// in the case of consecutive reads, use readNext (it uses a better buffer)
func (q *QLogFile) readProbeLine(position int64) (string, int64, int64, error) {
// First of all, we should read a buffer that will include the query log line
// In order to do this, we'll define the boundaries
</s> add // readProbeLine reads a line that includes the specified position. This
// method is supposed to be used when we use binary search in the Seek method.
// In the case of consecutive reads, use readNext, cause it uses better buffer.
func (q *qLogFile) readProbeLine(position int64) (string, int64, int64, error) {
// First of all, we should read a buffer that will include the query log
// line. In order to do this, we'll define the boundaries. </s> remove // 1. It starts with the position in the middle of a file
// 2. Shifts back to the beginning of the line
// 3. Checks the log record timestamp
// 4. If it is lower than the timestamp we are looking for,
// it shifts seek position to 3/4 of the file. Otherwise, to 1/4 of the file.
// 5. It performs the search again, every time the search scope is narrowed twice.
</s> add // 1. It starts with the position in the middle of a file.
// 2. Shifts back to the beginning of the line.
// 3. Checks the log record timestamp.
// 4. If it is lower than the timestamp we are looking for, it shifts seek
// position to 3/4 of the file. Otherwise, to 1/4 of the file.
// 5. It performs the search again, every time the search scope is narrowed
// twice. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// The algorithm is:
// 1. Check if we have the buffer initialized.
// 2. If it is so, scan it and look for the line there.
// 3. If we cannot find the line there, read the prev chunk into the buffer.
// 4. Read the line from the buffer.
func (q *qLogFile) readNextLine(position int64) (string, int64, error) { | <mask>
<mask> // readNextLine reads the next line from the specified position
<mask> // this line actually have to END on that position.
<mask> //
<mask> // the algorithm is:
<mask> // 1. check if we have the buffer initialized
<mask> // 2. if it is, scan it and look for the line there
<mask> // 3. if we cannot find the line there, read the prev chunk into the buffer
<mask> // 4. read the line from the buffer
<mask> func (q *QLogFile) readNextLine(position int64) (string, int64, error) {
<mask> relativePos := position - q.bufferStart
<mask> if q.buffer == nil || (relativePos < maxEntrySize && q.bufferStart != 0) {
<mask> // Time to re-init the buffer
<mask> err := q.initBuffer(position)
<mask> if err != nil {
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // readNextLine reads the next line from the specified position
// this line actually have to END on that position.
</s> add // readNextLine reads the next line from the specified position. This line
// actually have to END on that position. </s> remove // Time to re-init the buffer
</s> add // Time to re-init the buffer. </s> remove relativePos := position // position relative to the buffer we're going to read
</s> add // Position relative to the buffer we're going to read.
relativePos := position </s> remove // readProbeLine reads a line that includes the specified position
// this method is supposed to be used when we use binary search in the Seek method
// in the case of consecutive reads, use readNext (it uses a better buffer)
func (q *QLogFile) readProbeLine(position int64) (string, int64, int64, error) {
// First of all, we should read a buffer that will include the query log line
// In order to do this, we'll define the boundaries
</s> add // readProbeLine reads a line that includes the specified position. This
// method is supposed to be used when we use binary search in the Seek method.
// In the case of consecutive reads, use readNext, cause it uses better buffer.
func (q *qLogFile) readProbeLine(position int64) (string, int64, int64, error) {
// First of all, we should read a buffer that will include the query log
// line. In order to do this, we'll define the boundaries. </s> remove // Close frees the underlying resources
func (q *QLogFile) Close() error {
</s> add // Close frees the underlying resources.
func (q *qLogFile) Close() error { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Time to re-init the buffer. | <mask> // 4. read the line from the buffer
<mask> func (q *QLogFile) readNextLine(position int64) (string, int64, error) {
<mask> relativePos := position - q.bufferStart
<mask> if q.buffer == nil || (relativePos < maxEntrySize && q.bufferStart != 0) {
<mask> // Time to re-init the buffer
<mask> err := q.initBuffer(position)
<mask> if err != nil {
<mask> return "", 0, err
<mask> }
<mask> relativePos = position - q.bufferStart
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // the algorithm is:
// 1. check if we have the buffer initialized
// 2. if it is, scan it and look for the line there
// 3. if we cannot find the line there, read the prev chunk into the buffer
// 4. read the line from the buffer
func (q *QLogFile) readNextLine(position int64) (string, int64, error) {
</s> add // The algorithm is:
// 1. Check if we have the buffer initialized.
// 2. If it is so, scan it and look for the line there.
// 3. If we cannot find the line there, read the prev chunk into the buffer.
// 4. Read the line from the buffer.
func (q *qLogFile) readNextLine(position int64) (string, int64, error) { </s> remove relativePos := position // position relative to the buffer we're going to read
</s> add // Position relative to the buffer we're going to read.
relativePos := position </s> remove // initBuffer initializes the QLogFile buffer.
// the goal is to read a chunk of file that includes the line with the specified position.
func (q *QLogFile) initBuffer(position int64) error {
</s> add // initBuffer initializes the qLogFile buffer. The goal is to read a chunk of
// file that includes the line with the specified position.
func (q *qLogFile) initBuffer(position int64) error { </s> remove // readProbeLine reads a line that includes the specified position
// this method is supposed to be used when we use binary search in the Seek method
// in the case of consecutive reads, use readNext (it uses a better buffer)
func (q *QLogFile) readProbeLine(position int64) (string, int64, int64, error) {
// First of all, we should read a buffer that will include the query log line
// In order to do this, we'll define the boundaries
</s> add // readProbeLine reads a line that includes the specified position. This
// method is supposed to be used when we use binary search in the Seek method.
// In the case of consecutive reads, use readNext, cause it uses better buffer.
func (q *qLogFile) readProbeLine(position int64) (string, int64, int64, error) {
// First of all, we should read a buffer that will include the query log
// line. In order to do this, we'll define the boundaries. </s> remove // Look for the end of the prev line
// This is where we'll read from
</s> add // Look for the end of the prev line, this is where we'll read from. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Look for the end of the prev line, this is where we'll read from. | <mask> }
<mask> relativePos = position - q.bufferStart
<mask> }
<mask>
<mask> // Look for the end of the prev line
<mask> // This is where we'll read from
<mask> startLine := int64(0)
<mask> for i := relativePos - 1; i >= 0; i-- {
<mask> if q.buffer[i] == '\n' {
<mask> startLine = i + 1
<mask> break
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Now start looking for the new line character starting
// from the relativePos and going left
</s> add // Now start looking for the new line character starting from the
// relativePos and going left. </s> remove // Looking for the end of line now
</s> add // Looking for the end of line now. </s> remove if errors.Is(err, ErrTSTooEarly) {
</s> add if errors.Is(err, errTSTooEarly) { </s> remove // Time to re-init the buffer
</s> add // Time to re-init the buffer. </s> remove // initBuffer initializes the QLogFile buffer.
// the goal is to read a chunk of file that includes the line with the specified position.
func (q *QLogFile) initBuffer(position int64) error {
</s> add // initBuffer initializes the qLogFile buffer. The goal is to read a chunk of
// file that includes the line with the specified position.
func (q *qLogFile) initBuffer(position int64) error { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// initBuffer initializes the qLogFile buffer. The goal is to read a chunk of
// file that includes the line with the specified position.
func (q *qLogFile) initBuffer(position int64) error { | <mask> lineIdx := q.bufferStart + startLine
<mask> return line, lineIdx, nil
<mask> }
<mask>
<mask> // initBuffer initializes the QLogFile buffer.
<mask> // the goal is to read a chunk of file that includes the line with the specified position.
<mask> func (q *QLogFile) initBuffer(position int64) error {
<mask> q.bufferStart = int64(0)
<mask> if position > bufferSize {
<mask> q.bufferStart = position - bufferSize
<mask> }
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Time to re-init the buffer
</s> add // Time to re-init the buffer. </s> remove // Look for the end of the prev line
// This is where we'll read from
</s> add // Look for the end of the prev line, this is where we'll read from. </s> remove // Seek to this position
</s> add // Seek to this position. </s> remove // the algorithm is:
// 1. check if we have the buffer initialized
// 2. if it is, scan it and look for the line there
// 3. if we cannot find the line there, read the prev chunk into the buffer
// 4. read the line from the buffer
func (q *QLogFile) readNextLine(position int64) (string, int64, error) {
</s> add // The algorithm is:
// 1. Check if we have the buffer initialized.
// 2. If it is so, scan it and look for the line there.
// 3. If we cannot find the line there, read the prev chunk into the buffer.
// 4. Read the line from the buffer.
func (q *qLogFile) readNextLine(position int64) (string, int64, error) { </s> remove // readProbeLine reads a line that includes the specified position
// this method is supposed to be used when we use binary search in the Seek method
// in the case of consecutive reads, use readNext (it uses a better buffer)
func (q *QLogFile) readProbeLine(position int64) (string, int64, int64, error) {
// First of all, we should read a buffer that will include the query log line
// In order to do this, we'll define the boundaries
</s> add // readProbeLine reads a line that includes the specified position. This
// method is supposed to be used when we use binary search in the Seek method.
// In the case of consecutive reads, use readNext, cause it uses better buffer.
func (q *qLogFile) readProbeLine(position int64) (string, int64, int64, error) {
// First of all, we should read a buffer that will include the query log
// line. In order to do this, we'll define the boundaries. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Seek to this position. | <mask> if position > bufferSize {
<mask> q.bufferStart = position - bufferSize
<mask> }
<mask>
<mask> // Seek to this position
<mask> _, err := q.file.Seek(q.bufferStart, io.SeekStart)
<mask> if err != nil {
<mask> return err
<mask> }
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Seek to this position
</s> add // Seek to this position. </s> remove // initBuffer initializes the QLogFile buffer.
// the goal is to read a chunk of file that includes the line with the specified position.
func (q *QLogFile) initBuffer(position int64) error {
</s> add // initBuffer initializes the qLogFile buffer. The goal is to read a chunk of
// file that includes the line with the specified position.
func (q *qLogFile) initBuffer(position int64) error { </s> remove // Time to re-init the buffer
</s> add // Time to re-init the buffer. </s> remove // Place the position to the very end of file
</s> add // Place the position to the very end of file. </s> remove // Look for the end of the prev line
// This is where we'll read from
</s> add // Look for the end of the prev line, this is where we'll read from. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// readProbeLine reads a line that includes the specified position. This
// method is supposed to be used when we use binary search in the Seek method.
// In the case of consecutive reads, use readNext, cause it uses better buffer.
func (q *qLogFile) readProbeLine(position int64) (string, int64, int64, error) {
// First of all, we should read a buffer that will include the query log
// line. In order to do this, we'll define the boundaries. | <mask>
<mask> return err
<mask> }
<mask>
<mask> // readProbeLine reads a line that includes the specified position
<mask> // this method is supposed to be used when we use binary search in the Seek method
<mask> // in the case of consecutive reads, use readNext (it uses a better buffer)
<mask> func (q *QLogFile) readProbeLine(position int64) (string, int64, int64, error) {
<mask> // First of all, we should read a buffer that will include the query log line
<mask> // In order to do this, we'll define the boundaries
<mask> seekPosition := int64(0)
<mask> relativePos := position // position relative to the buffer we're going to read
<mask> if position > maxEntrySize {
<mask> seekPosition = position - maxEntrySize
<mask> relativePos = maxEntrySize
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove relativePos := position // position relative to the buffer we're going to read
</s> add // Position relative to the buffer we're going to read.
relativePos := position </s> remove // Time to re-init the buffer
</s> add // Time to re-init the buffer. </s> remove // the algorithm is:
// 1. check if we have the buffer initialized
// 2. if it is, scan it and look for the line there
// 3. if we cannot find the line there, read the prev chunk into the buffer
// 4. read the line from the buffer
func (q *QLogFile) readNextLine(position int64) (string, int64, error) {
</s> add // The algorithm is:
// 1. Check if we have the buffer initialized.
// 2. If it is so, scan it and look for the line there.
// 3. If we cannot find the line there, read the prev chunk into the buffer.
// 4. Read the line from the buffer.
func (q *qLogFile) readNextLine(position int64) (string, int64, error) { </s> remove // initBuffer initializes the QLogFile buffer.
// the goal is to read a chunk of file that includes the line with the specified position.
func (q *QLogFile) initBuffer(position int64) error {
</s> add // initBuffer initializes the qLogFile buffer. The goal is to read a chunk of
// file that includes the line with the specified position.
func (q *qLogFile) initBuffer(position int64) error { </s> remove // QLogFile represents a single query log file
// It allows reading from the file in the reverse order
//
// Please note that this is a stateful object.
// Internally, it contains a pointer to a specific position in the file,
// and it reads lines in reverse order starting from that position.
type QLogFile struct {
file *os.File // the query log file
position int64 // current position in the file
buffer []byte // buffer that we've read from the file
bufferStart int64 // start of the buffer (in the file)
bufferLen int // buffer len
lock sync.Mutex // We use mutex to make it thread-safe
</s> add // lock is a mutex to make it thread-safe.
lock sync.Mutex
// position is the position in the file.
position int64
// bufferStart is the start of the buffer (in the file).
bufferStart int64
// bufferLen is the length of the buffer.
bufferLen int | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Position relative to the buffer we're going to read.
relativePos := position | <mask> func (q *QLogFile) readProbeLine(position int64) (string, int64, int64, error) {
<mask> // First of all, we should read a buffer that will include the query log line
<mask> // In order to do this, we'll define the boundaries
<mask> seekPosition := int64(0)
<mask> relativePos := position // position relative to the buffer we're going to read
<mask> if position > maxEntrySize {
<mask> seekPosition = position - maxEntrySize
<mask> relativePos = maxEntrySize
<mask> }
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // readProbeLine reads a line that includes the specified position
// this method is supposed to be used when we use binary search in the Seek method
// in the case of consecutive reads, use readNext (it uses a better buffer)
func (q *QLogFile) readProbeLine(position int64) (string, int64, int64, error) {
// First of all, we should read a buffer that will include the query log line
// In order to do this, we'll define the boundaries
</s> add // readProbeLine reads a line that includes the specified position. This
// method is supposed to be used when we use binary search in the Seek method.
// In the case of consecutive reads, use readNext, cause it uses better buffer.
func (q *qLogFile) readProbeLine(position int64) (string, int64, int64, error) {
// First of all, we should read a buffer that will include the query log
// line. In order to do this, we'll define the boundaries. </s> remove // Time to re-init the buffer
</s> add // Time to re-init the buffer. </s> remove // the algorithm is:
// 1. check if we have the buffer initialized
// 2. if it is, scan it and look for the line there
// 3. if we cannot find the line there, read the prev chunk into the buffer
// 4. read the line from the buffer
func (q *QLogFile) readNextLine(position int64) (string, int64, error) {
</s> add // The algorithm is:
// 1. Check if we have the buffer initialized.
// 2. If it is so, scan it and look for the line there.
// 3. If we cannot find the line there, read the prev chunk into the buffer.
// 4. Read the line from the buffer.
func (q *qLogFile) readNextLine(position int64) (string, int64, error) { </s> remove // Seek to this position
</s> add // Seek to this position. </s> remove // initBuffer initializes the QLogFile buffer.
// the goal is to read a chunk of file that includes the line with the specified position.
func (q *QLogFile) initBuffer(position int64) error {
</s> add // initBuffer initializes the qLogFile buffer. The goal is to read a chunk of
// file that includes the line with the specified position.
func (q *qLogFile) initBuffer(position int64) error { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Seek to this position. | <mask> seekPosition = position - maxEntrySize
<mask> relativePos = maxEntrySize
<mask> }
<mask>
<mask> // Seek to this position
<mask> _, err := q.file.Seek(seekPosition, io.SeekStart)
<mask> if err != nil {
<mask> return "", 0, 0, err
<mask> }
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Seek to this position
</s> add // Seek to this position. </s> remove // Time to re-init the buffer
</s> add // Time to re-init the buffer. </s> remove relativePos := position // position relative to the buffer we're going to read
</s> add // Position relative to the buffer we're going to read.
relativePos := position </s> remove // readProbeLine reads a line that includes the specified position
// this method is supposed to be used when we use binary search in the Seek method
// in the case of consecutive reads, use readNext (it uses a better buffer)
func (q *QLogFile) readProbeLine(position int64) (string, int64, int64, error) {
// First of all, we should read a buffer that will include the query log line
// In order to do this, we'll define the boundaries
</s> add // readProbeLine reads a line that includes the specified position. This
// method is supposed to be used when we use binary search in the Seek method.
// In the case of consecutive reads, use readNext, cause it uses better buffer.
func (q *qLogFile) readProbeLine(position int64) (string, int64, int64, error) {
// First of all, we should read a buffer that will include the query log
// line. In order to do this, we'll define the boundaries. </s> remove // The buffer size is 2*maxEntrySize
</s> add // The buffer size is 2*maxEntrySize. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// The buffer size is 2*maxEntrySize. | <mask> if err != nil {
<mask> return "", 0, 0, err
<mask> }
<mask>
<mask> // The buffer size is 2*maxEntrySize
<mask> buffer := make([]byte, maxEntrySize*2)
<mask> bufferLen, err := q.file.Read(buffer)
<mask> if err != nil {
<mask> return "", 0, 0, err
<mask> }
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // First of all, check the file size
</s> add // First of all, check the file size. </s> remove // Seek to this position
</s> add // Seek to this position. </s> remove // Time to re-init the buffer
</s> add // Time to re-init the buffer. </s> remove // First of all, check the file size
</s> add // First of all, check the file size. </s> remove // Now start looking for the new line character starting
// from the relativePos and going left
</s> add // Now start looking for the new line character starting from the
// relativePos and going left. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Now start looking for the new line character starting from the
// relativePos and going left. | <mask> if err != nil {
<mask> return "", 0, 0, err
<mask> }
<mask>
<mask> // Now start looking for the new line character starting
<mask> // from the relativePos and going left
<mask> startLine := int64(0)
<mask> for i := relativePos - 1; i >= 0; i-- {
<mask> if buffer[i] == '\n' {
<mask> startLine = i + 1
<mask> break
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Look for the end of the prev line
// This is where we'll read from
</s> add // Look for the end of the prev line, this is where we'll read from. </s> remove // Looking for the end of line now
</s> add // Looking for the end of line now. </s> remove if errors.Is(err, ErrTSTooEarly) {
</s> add if errors.Is(err, errTSTooEarly) { </s> remove // Time to re-init the buffer
</s> add // Time to re-init the buffer. </s> remove // timestamp. If the record is found, it sets QLogReader's position to point to
// that line, so that the next ReadNext call returned this line.
func (r *QLogReader) seekTS(timestamp int64) (err error) {
</s> add // timestamp. If the record is found, it sets qLogReader's position to point
// to that line, so that the next ReadNext call returned this line.
func (r *qLogReader) seekTS(timestamp int64) (err error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Looking for the end of line now. | <mask> startLine = i + 1
<mask> break
<mask> }
<mask> }
<mask> // Looking for the end of line now
<mask> endLine := int64(bufferLen)
<mask> lineEndIdx := endLine + seekPosition
<mask> for i := relativePos; i < int64(bufferLen); i++ {
<mask> if buffer[i] == '\n' {
<mask> endLine = i
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Look for the end of the prev line
// This is where we'll read from
</s> add // Look for the end of the prev line, this is where we'll read from. </s> remove // Now start looking for the new line character starting
// from the relativePos and going left
</s> add // Now start looking for the new line character starting from the
// relativePos and going left. </s> remove // readJSONvalue reads a JSON string in form of '"key":"value"'. prefix must be
// of the form '"key":"' to generate less garbage.
</s> add // readJSONValue reads a JSON string in form of '"key":"value"'. prefix must
// be of the form '"key":"' to generate less garbage. </s> remove // readQLogTimestamp reads the timestamp field from the query log line
</s> add // readQLogTimestamp reads the timestamp field from the query log line. </s> remove func getQLogFileLine(q *QLogFile, lineNumber int) (line string, err error) {
</s> add func getQLogFileLine(q *qLogFile, lineNumber int) (line string, err error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// Finally we can return the string we were looking for. | <mask> break
<mask> }
<mask> }
<mask>
<mask> // Finally we can return the string we were looking for
<mask> lineIdx := startLine + seekPosition
<mask> return string(buffer[startLine:endLine]), lineIdx, lineEndIdx, nil
<mask> }
<mask>
<mask> // readJSONvalue reads a JSON string in form of '"key":"value"'. prefix must be
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // readJSONvalue reads a JSON string in form of '"key":"value"'. prefix must be
// of the form '"key":"' to generate less garbage.
</s> add // readJSONValue reads a JSON string in form of '"key":"value"'. prefix must
// be of the form '"key":"' to generate less garbage. </s> remove // Looking for the end of line now
</s> add // Looking for the end of line now. </s> remove // Now start looking for the new line character starting
// from the relativePos and going left
</s> add // Now start looking for the new line character starting from the
// relativePos and going left. </s> remove // there's usually a line break before the line
// so we should shift one more char left from the line
// line\nline
</s> add // There's usually a line break before the line, so we should shift one
// more char left from the line "\nline". </s> remove totalLimit := params.offset + params.limit
oldestNano := int64(0)
</s> add return r, nil
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// readJSONValue reads a JSON string in form of '"key":"value"'. prefix must
// be of the form '"key":"' to generate less garbage. | <mask> lineIdx := startLine + seekPosition
<mask> return string(buffer[startLine:endLine]), lineIdx, lineEndIdx, nil
<mask> }
<mask>
<mask> // readJSONvalue reads a JSON string in form of '"key":"value"'. prefix must be
<mask> // of the form '"key":"' to generate less garbage.
<mask> func readJSONValue(s, prefix string) string {
<mask> i := strings.Index(s, prefix)
<mask> if i == -1 {
<mask> return ""
<mask> }
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Finally we can return the string we were looking for
</s> add // Finally we can return the string we were looking for. </s> remove // Looking for the end of line now
</s> add // Looking for the end of line now. </s> remove // readQLogTimestamp reads the timestamp field from the query log line
</s> add // readQLogTimestamp reads the timestamp field from the query log line. </s> remove // Look for the end of the prev line
// This is where we'll read from
</s> add // Look for the end of the prev line, this is where we'll read from. </s> remove // Now start looking for the new line character starting
// from the relativePos and going left
</s> add // Now start looking for the new line character starting from the
// relativePos and going left. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// readQLogTimestamp reads the timestamp field from the query log line. | <mask> end := start + i
<mask> return s[start:end]
<mask> }
<mask>
<mask> // readQLogTimestamp reads the timestamp field from the query log line
<mask> func readQLogTimestamp(str string) int64 {
<mask> val := readJSONValue(str, `"T":"`)
<mask> if len(val) == 0 {
<mask> val = readJSONValue(str, `"Time":"`)
<mask> }
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Looking for the end of line now
</s> add // Looking for the end of line now. </s> remove // Now start looking for the new line character starting
// from the relativePos and going left
</s> add // Now start looking for the new line character starting from the
// relativePos and going left. </s> remove // Look for the end of the prev line
// This is where we'll read from
</s> add // Look for the end of the prev line, this is where we'll read from. </s> remove // Save the last found idx
</s> add // Save the last found idx. </s> remove // readJSONvalue reads a JSON string in form of '"key":"value"'. prefix must be
// of the form '"key":"' to generate less garbage.
</s> add // readJSONValue reads a JSON string in form of '"key":"value"'. prefix must
// be of the form '"key":"' to generate less garbage. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile.go |
// newTestQLogFile creates new *qLogFile for tests and registers the required | <mask>
<mask> return files
<mask> }
<mask>
<mask> // newTestQLogFile creates new *QLogFile for tests and registers the required
<mask> // cleanup functions.
<mask> func newTestQLogFile(t *testing.T, linesNum int) (file *QLogFile) {
<mask> t.Helper()
<mask>
<mask> testFile := prepareTestFiles(t, 1, linesNum)[0]
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove func newTestQLogFile(t *testing.T, linesNum int) (file *QLogFile) {
</s> add func newTestQLogFile(t *testing.T, linesNum int) (file *qLogFile) { </s> remove // newTestQLogReader creates new *QLogReader for tests and registers the
</s> add // newTestQLogReader creates new *qLogReader for tests and registers the </s> remove func newTestQLogReader(t *testing.T, filesNum, linesNum int) (reader *QLogReader) {
</s> add func newTestQLogReader(t *testing.T, filesNum, linesNum int) (reader *qLogReader) { </s> remove // Create the new QLogFile instance.
file, err := NewQLogFile(testFile)
</s> add // Create the new qLogFile instance.
file, err := newQLogFile(testFile) </s> remove func NewTestQLogFileData(t *testing.T, data string) (file *QLogFile) {
</s> add func newTestQLogFileData(t *testing.T, data string) (file *qLogFile) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile_test.go |
func newTestQLogFile(t *testing.T, linesNum int) (file *qLogFile) { | <mask> }
<mask>
<mask> // newTestQLogFile creates new *QLogFile for tests and registers the required
<mask> // cleanup functions.
<mask> func newTestQLogFile(t *testing.T, linesNum int) (file *QLogFile) {
<mask> t.Helper()
<mask>
<mask> testFile := prepareTestFiles(t, 1, linesNum)[0]
<mask>
<mask> // Create the new QLogFile instance.
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // newTestQLogFile creates new *QLogFile for tests and registers the required
</s> add // newTestQLogFile creates new *qLogFile for tests and registers the required </s> remove func newTestQLogReader(t *testing.T, filesNum, linesNum int) (reader *QLogReader) {
</s> add func newTestQLogReader(t *testing.T, filesNum, linesNum int) (reader *qLogReader) { </s> remove // newTestQLogReader creates new *QLogReader for tests and registers the
</s> add // newTestQLogReader creates new *qLogReader for tests and registers the </s> remove // Create the new QLogFile instance.
file, err := NewQLogFile(testFile)
</s> add // Create the new qLogFile instance.
file, err := newQLogFile(testFile) </s> remove // Create the new QLogReader instance.
reader, err := NewQLogReader(testFiles)
</s> add // Create the new qLogReader instance.
reader, err := newQLogReader(testFiles) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile_test.go |
// Create the new qLogFile instance.
file, err := newQLogFile(testFile) | <mask> t.Helper()
<mask>
<mask> testFile := prepareTestFiles(t, 1, linesNum)[0]
<mask>
<mask> // Create the new QLogFile instance.
<mask> file, err := NewQLogFile(testFile)
<mask> require.NoError(t, err)
<mask>
<mask> assert.NotNil(t, file)
<mask> testutil.CleanupAndRequireSuccess(t, file.Close)
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Create the new QLogReader instance.
reader, err := NewQLogReader(testFiles)
</s> add // Create the new qLogReader instance.
reader, err := newQLogReader(testFiles) </s> remove func newTestQLogFile(t *testing.T, linesNum int) (file *QLogFile) {
</s> add func newTestQLogFile(t *testing.T, linesNum int) (file *qLogFile) { </s> remove // Create the new QLogFile instance.
</s> add // Create the new qLogFile instance. </s> remove // newTestQLogFile creates new *QLogFile for tests and registers the required
</s> add // newTestQLogFile creates new *qLogFile for tests and registers the required </s> remove file, err = NewQLogFile(f.Name())
</s> add file, err = newQLogFile(f.Name()) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile_test.go |
func getQLogFileLine(q *qLogFile, lineNumber int) (line string, err error) { | <mask> }
<mask> }
<mask> }
<mask>
<mask> func getQLogFileLine(q *QLogFile, lineNumber int) (line string, err error) {
<mask> if _, err = q.SeekStart(); err != nil {
<mask> return line, err
<mask> }
<mask>
<mask> for i := 1; i < lineNumber; i++ {
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Looking for the end of line now
</s> add // Looking for the end of line now. </s> remove // timestamp. If the record is found, it sets QLogReader's position to point to
// that line, so that the next ReadNext call returned this line.
func (r *QLogReader) seekTS(timestamp int64) (err error) {
</s> add // timestamp. If the record is found, it sets qLogReader's position to point
// to that line, so that the next ReadNext call returned this line.
func (r *qLogReader) seekTS(timestamp int64) (err error) { </s> remove // Look for the end of the prev line
// This is where we'll read from
</s> add // Look for the end of the prev line, this is where we'll read from. </s> remove if d, ok := delimToken.(json.Delim); ok {
if d != '[' {
log.Debug("decodeResultRules: unexpected delim %q", d)
}
} else {
</s> add if d, ok := delimToken.(json.Delim); !ok { </s> remove i := 0
for {
var keyToken json.Token
keyToken, err = dec.Token()
if err != nil {
if err != io.EOF {
log.Debug("decodeResultRules err: %s", err)
}
return
</s> add err = decodeResultRuleToken(dec, ent)
if err != nil {
if err != io.EOF && !errors.Is(err, ErrEndOfToken) {
log.Debug("decodeResultRules err: %s", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile_test.go |
// Create the new qLogFile instance. | <mask> }
<mask>
<mask> // Check adding and loading (with filtering) entries from disk and memory.
<mask> func TestQLogFile(t *testing.T) {
<mask> // Create the new QLogFile instance.
<mask> q := newTestQLogFile(t, 2)
<mask>
<mask> // Seek to the start.
<mask> pos, err := q.SeekStart()
<mask> require.NoError(t, err)
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Create the new QLogFile instance.
file, err := NewQLogFile(testFile)
</s> add // Create the new qLogFile instance.
file, err := newQLogFile(testFile) </s> remove // Create the new QLogReader instance.
reader, err := NewQLogReader(testFiles)
</s> add // Create the new qLogReader instance.
reader, err := newQLogReader(testFiles) </s> remove func newTestQLogFile(t *testing.T, linesNum int) (file *QLogFile) {
</s> add func newTestQLogFile(t *testing.T, linesNum int) (file *qLogFile) { </s> remove func newTestQLogReader(t *testing.T, filesNum, linesNum int) (reader *QLogReader) {
</s> add func newTestQLogReader(t *testing.T, filesNum, linesNum int) (reader *qLogReader) { </s> remove // Now start looking for the new line character starting
// from the relativePos and going left
</s> add // Now start looking for the new line character starting from the
// relativePos and going left. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile_test.go |
func newTestQLogFileData(t *testing.T, data string) (file *qLogFile) { | <mask> require.Equal(t, io.EOF, err)
<mask> assert.Empty(t, line)
<mask> }
<mask>
<mask> func NewTestQLogFileData(t *testing.T, data string) (file *QLogFile) {
<mask> f, err := os.CreateTemp(t.TempDir(), "*.txt")
<mask> require.NoError(t, err)
<mask> testutil.CleanupAndRequireSuccess(t, f.Close)
<mask>
<mask> _, err = f.WriteString(data)
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove file, err = NewQLogFile(f.Name())
</s> add file, err = newQLogFile(f.Name()) </s> remove func newTestQLogFile(t *testing.T, linesNum int) (file *QLogFile) {
</s> add func newTestQLogFile(t *testing.T, linesNum int) (file *qLogFile) { </s> remove // Create the new QLogReader instance.
reader, err := NewQLogReader(testFiles)
</s> add // Create the new qLogReader instance.
reader, err := newQLogReader(testFiles) </s> remove // Create the new QLogFile instance.
file, err := NewQLogFile(testFile)
</s> add // Create the new qLogFile instance.
file, err := newQLogFile(testFile) </s> remove // newTestQLogFile creates new *QLogFile for tests and registers the required
</s> add // newTestQLogFile creates new *qLogFile for tests and registers the required | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile_test.go |
file, err = newQLogFile(f.Name()) | <mask>
<mask> _, err = f.WriteString(data)
<mask> require.NoError(t, err)
<mask>
<mask> file, err = NewQLogFile(f.Name())
<mask> require.NoError(t, err)
<mask> testutil.CleanupAndRequireSuccess(t, file.Close)
<mask>
<mask> return file
<mask> }
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove func NewTestQLogFileData(t *testing.T, data string) (file *QLogFile) {
</s> add func newTestQLogFileData(t *testing.T, data string) (file *qLogFile) { </s> remove // Create the new QLogFile instance.
file, err := NewQLogFile(testFile)
</s> add // Create the new qLogFile instance.
file, err := newQLogFile(testFile) </s> remove // Create the new QLogReader instance.
reader, err := NewQLogReader(testFiles)
</s> add // Create the new qLogReader instance.
reader, err := newQLogReader(testFiles) </s> remove // Create the new QLogFile instance.
</s> add // Create the new qLogFile instance. </s> remove log.Error("querylog: opening qlog reader: %s", err)
return entries, oldest, 0
}
defer func() {
closeErr := r.Close()
if closeErr != nil {
log.Error("querylog: closing file: %s", err)
}
}()
if params.olderThan.IsZero() {
err = r.SeekStart()
} else {
err = r.seekTS(params.olderThan.UnixNano())
if err == nil {
// Read to the next record, because we only need the one that goes
// after it.
_, err = r.ReadNext()
}
</s> add return nil, fmt.Errorf("opening qlog reader: %s", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile_test.go |
wantErr error | <mask> timestamp, _ := time.Parse(time.RFC3339Nano, "2020-08-31T18:44:25.376690873+03:00")
<mask>
<mask> testCases := []struct {
<mask> name string
<mask> delta int
<mask> wantDepth int
<mask> }{{
<mask> name: "ok",
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove wantErr error
</s> add </s> remove want error
</s> add </s> remove want error
</s> add | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile_test.go |
<mask>
<mask> testCases := []struct {
<mask> name string
<mask> delta int
<mask> wantErr error
<mask> wantDepth int
<mask> }{{
<mask> name: "ok",
<mask> delta: 0,
<mask> wantErr: nil,
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove want error
</s> add </s> remove want error
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile_test.go | |
wantErr: errTSTooLate, | <mask> wantDepth: 2,
<mask> }, {
<mask> name: "too_late",
<mask> delta: 2,
<mask> wantErr: ErrTSTooLate,
<mask> wantDepth: 2,
<mask> }, {
<mask> name: "too_early",
<mask> delta: -2,
<mask> wantErr: ErrTSTooEarly,
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove wantErr: ErrTSTooEarly,
</s> add wantErr: errTSTooEarly, </s> remove wantErr error
</s> add </s> remove num int
host string
answer, client net.IP
</s> add host string
answer net.IP
client net.IP
num int </s> remove want: ErrTSNotFound,
</s> add want: errTSNotFound, </s> remove want error
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile_test.go |
wantErr: errTSTooEarly, | <mask> wantDepth: 2,
<mask> }, {
<mask> name: "too_early",
<mask> delta: -2,
<mask> wantErr: ErrTSTooEarly,
<mask> wantDepth: 1,
<mask> }}
<mask>
<mask> for _, tc := range testCases {
<mask> t.Run(tc.name, func(t *testing.T) {
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove wantErr: ErrTSTooLate,
</s> add wantErr: errTSTooLate, </s> remove want: ErrTSNotFound,
</s> add want: errTSNotFound, </s> remove wantErr error
</s> add </s> remove num int
host string
answer, client net.IP
</s> add host string
answer net.IP
client net.IP
num int </s> remove want error
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile_test.go |
q := newTestQLogFileData(t, data) | <mask> timestamp.Format(time.RFC3339Nano),
<mask> timestamp.Add(time.Second).Format(time.RFC3339Nano),
<mask> )
<mask>
<mask> q := NewTestQLogFileData(t, data)
<mask>
<mask> _, depth, err := q.seekTS(timestamp.Add(time.Second * time.Duration(tc.delta)).UnixNano())
<mask> require.Truef(t, errors.Is(err, tc.wantErr), "%v", err)
<mask> assert.Equal(t, tc.wantDepth, depth)
<mask> })
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove if errors.Is(err, ErrTSTooEarly) {
</s> add if errors.Is(err, errTSTooEarly) { </s> remove q, err := NewQLogFile(f)
</s> add q, err := newQLogFile(f) </s> remove // timestamp. If the record is found, it sets QLogReader's position to point to
// that line, so that the next ReadNext call returned this line.
func (r *QLogReader) seekTS(timestamp int64) (err error) {
</s> add // timestamp. If the record is found, it sets qLogReader's position to point
// to that line, so that the next ReadNext call returned this line.
func (r *qLogReader) seekTS(timestamp int64) (err error) { </s> remove // Create the new QLogFile instance.
</s> add // Create the new qLogFile instance. </s> remove func NewTestQLogFileData(t *testing.T, data string) (file *QLogFile) {
</s> add func newTestQLogFileData(t *testing.T, data string) (file *qLogFile) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogfile_test.go |
// qLogReader allows reading from multiple query log files in the reverse
// order. | <mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> )
<mask>
<mask> // QLogReader allows reading from multiple query log files in the reverse order.
<mask> //
<mask> // Please note that this is a stateful object.
<mask> // Internally, it contains a pointer to a particular query log file, and
<mask> // to a specific position in this file, and it reads lines in reverse order
<mask> // starting from that position.
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // Please note that this is a stateful object.
// Internally, it contains a pointer to a particular query log file, and
// to a specific position in this file, and it reads lines in reverse order
// starting from that position.
type QLogReader struct {
// qFiles - array with the query log files
// The order is - from oldest to newest
qFiles []*QLogFile
currentFile int // Index of the current file
</s> add // Please note that this is a stateful object. Internally, it contains a
// pointer to a particular query log file, and to a specific position in this
// file, and it reads lines in reverse order starting from that position.
type qLogReader struct {
// qFiles is an array with the query log files. The order is from oldest
// to newest.
qFiles []*qLogFile
// currentFile is the index of the current file.
currentFile int </s> remove // TODO: Find a way to grow buffer instead of relying on this value when reading strings
const maxEntrySize = 16 * 1024
</s> add // qLogFile represents a single query log file. It allows reading from the
// file in the reverse order.
//
// Please note, that this is a stateful object. Internally, it contains a
// pointer to a specific position in the file, and it reads lines in reverse
// order starting from that position.
type qLogFile struct {
// file is the query log file.
file *os.File </s> remove // QLogFile represents a single query log file
// It allows reading from the file in the reverse order
//
// Please note that this is a stateful object.
// Internally, it contains a pointer to a specific position in the file,
// and it reads lines in reverse order starting from that position.
type QLogFile struct {
file *os.File // the query log file
position int64 // current position in the file
buffer []byte // buffer that we've read from the file
bufferStart int64 // start of the buffer (in the file)
bufferLen int // buffer len
lock sync.Mutex // We use mutex to make it thread-safe
</s> add // lock is a mutex to make it thread-safe.
lock sync.Mutex
// position is the position in the file.
position int64
// bufferStart is the start of the buffer (in the file).
bufferStart int64
// bufferLen is the length of the buffer.
bufferLen int </s> remove // buffer should be enough for at least this number of entries
const bufferSize = 100 * maxEntrySize
</s> add // buffer that we've read from the file.
buffer []byte </s> remove // SeekStart changes the current position to the end of the newest file
// Please note that we're reading query log in the reverse order
// and that's why log start is actually the end of file
</s> add // SeekStart changes the current position to the end of the newest file.
// Please note that we're reading query log in the reverse order and that's why
// the log starts actually at the end of file. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogreader.go |
// Please note that this is a stateful object. Internally, it contains a
// pointer to a particular query log file, and to a specific position in this
// file, and it reads lines in reverse order starting from that position.
type qLogReader struct {
// qFiles is an array with the query log files. The order is from oldest
// to newest.
qFiles []*qLogFile
// currentFile is the index of the current file.
currentFile int | <mask> )
<mask>
<mask> // QLogReader allows reading from multiple query log files in the reverse order.
<mask> //
<mask> // Please note that this is a stateful object.
<mask> // Internally, it contains a pointer to a particular query log file, and
<mask> // to a specific position in this file, and it reads lines in reverse order
<mask> // starting from that position.
<mask> type QLogReader struct {
<mask> // qFiles - array with the query log files
<mask> // The order is - from oldest to newest
<mask> qFiles []*QLogFile
<mask>
<mask> currentFile int // Index of the current file
<mask> }
<mask>
<mask> // NewQLogReader initializes a QLogReader instance
<mask> // with the specified files
<mask> func NewQLogReader(files []string) (*QLogReader, error) {
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // QLogReader allows reading from multiple query log files in the reverse order.
</s> add // qLogReader allows reading from multiple query log files in the reverse
// order. </s> remove // TODO: Find a way to grow buffer instead of relying on this value when reading strings
const maxEntrySize = 16 * 1024
</s> add // qLogFile represents a single query log file. It allows reading from the
// file in the reverse order.
//
// Please note, that this is a stateful object. Internally, it contains a
// pointer to a specific position in the file, and it reads lines in reverse
// order starting from that position.
type qLogFile struct {
// file is the query log file.
file *os.File </s> remove // NewQLogReader initializes a QLogReader instance
// with the specified files
func NewQLogReader(files []string) (*QLogReader, error) {
qFiles := make([]*QLogFile, 0)
</s> add // newQLogReader initializes a qLogReader instance with the specified files.
func newQLogReader(files []string) (*qLogReader, error) {
qFiles := make([]*qLogFile, 0) </s> remove // QLogFile represents a single query log file
// It allows reading from the file in the reverse order
//
// Please note that this is a stateful object.
// Internally, it contains a pointer to a specific position in the file,
// and it reads lines in reverse order starting from that position.
type QLogFile struct {
file *os.File // the query log file
position int64 // current position in the file
buffer []byte // buffer that we've read from the file
bufferStart int64 // start of the buffer (in the file)
bufferLen int // buffer len
lock sync.Mutex // We use mutex to make it thread-safe
</s> add // lock is a mutex to make it thread-safe.
lock sync.Mutex
// position is the position in the file.
position int64
// bufferStart is the start of the buffer (in the file).
bufferStart int64
// bufferLen is the length of the buffer.
bufferLen int </s> remove // buffer should be enough for at least this number of entries
const bufferSize = 100 * maxEntrySize
</s> add // buffer that we've read from the file.
buffer []byte | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogreader.go |
// newQLogReader initializes a qLogReader instance with the specified files.
func newQLogReader(files []string) (*qLogReader, error) {
qFiles := make([]*qLogFile, 0) | <mask>
<mask> currentFile int // Index of the current file
<mask> }
<mask>
<mask> // NewQLogReader initializes a QLogReader instance
<mask> // with the specified files
<mask> func NewQLogReader(files []string) (*QLogReader, error) {
<mask> qFiles := make([]*QLogFile, 0)
<mask>
<mask> for _, f := range files {
<mask> q, err := NewQLogFile(f)
<mask> if err != nil {
<mask> if errors.Is(err, os.ErrNotExist) {
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove q, err := NewQLogFile(f)
</s> add q, err := newQLogFile(f) </s> remove // Please note that this is a stateful object.
// Internally, it contains a pointer to a particular query log file, and
// to a specific position in this file, and it reads lines in reverse order
// starting from that position.
type QLogReader struct {
// qFiles - array with the query log files
// The order is - from oldest to newest
qFiles []*QLogFile
currentFile int // Index of the current file
</s> add // Please note that this is a stateful object. Internally, it contains a
// pointer to a particular query log file, and to a specific position in this
// file, and it reads lines in reverse order starting from that position.
type qLogReader struct {
// qFiles is an array with the query log files. The order is from oldest
// to newest.
qFiles []*qLogFile
// currentFile is the index of the current file.
currentFile int </s> remove // NewQLogFile initializes a new instance of the QLogFile
func NewQLogFile(path string) (*QLogFile, error) {
</s> add // newQLogFile initializes a new instance of the qLogFile.
func newQLogFile(path string) (qf *qLogFile, err error) { </s> remove // initBuffer initializes the QLogFile buffer.
// the goal is to read a chunk of file that includes the line with the specified position.
func (q *QLogFile) initBuffer(position int64) error {
</s> add // initBuffer initializes the qLogFile buffer. The goal is to read a chunk of
// file that includes the line with the specified position.
func (q *qLogFile) initBuffer(position int64) error { </s> remove // timestamp. If the record is found, it sets QLogReader's position to point to
// that line, so that the next ReadNext call returned this line.
func (r *QLogReader) seekTS(timestamp int64) (err error) {
</s> add // timestamp. If the record is found, it sets qLogReader's position to point
// to that line, so that the next ReadNext call returned this line.
func (r *qLogReader) seekTS(timestamp int64) (err error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogreader.go |
q, err := newQLogFile(f) | <mask> func NewQLogReader(files []string) (*QLogReader, error) {
<mask> qFiles := make([]*QLogFile, 0)
<mask>
<mask> for _, f := range files {
<mask> q, err := NewQLogFile(f)
<mask> if err != nil {
<mask> if errors.Is(err, os.ErrNotExist) {
<mask> continue
<mask> }
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // NewQLogReader initializes a QLogReader instance
// with the specified files
func NewQLogReader(files []string) (*QLogReader, error) {
qFiles := make([]*QLogFile, 0)
</s> add // newQLogReader initializes a qLogReader instance with the specified files.
func newQLogReader(files []string) (*qLogReader, error) {
qFiles := make([]*qLogFile, 0) </s> remove // closeQFiles - helper method to close multiple QLogFile instances
func closeQFiles(qFiles []*QLogFile) error {
</s> add // closeQFiles is a helper method to close multiple qLogFile instances.
func closeQFiles(qFiles []*qLogFile) error { </s> remove if errors.Is(err, ErrTSTooEarly) {
</s> add if errors.Is(err, errTSTooEarly) { </s> remove for rrType, rrValues := range ent.Result.DNSRewriteResult.Response {
switch rrType {
case
dns.TypeA,
dns.TypeAAAA:
for i, v := range rrValues {
s, _ := v.(string)
rrValues[i] = net.ParseIP(s)
}
default:
// Go on.
}
}
</s> add ent.parseDNSRewriteResultIPs() </s> remove func getQLogFileLine(q *QLogFile, lineNumber int) (line string, err error) {
</s> add func getQLogFileLine(q *qLogFile, lineNumber int) (line string, err error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogreader.go |
cErr := closeQFiles(qFiles)
if cErr != nil {
log.Debug("querylog: closing files: %s", cErr) | <mask> continue
<mask> }
<mask>
<mask> // Close what we've already opened.
<mask> cerr := closeQFiles(qFiles)
<mask> if cerr != nil {
<mask> log.Debug("querylog: closing files: %s", cerr)
<mask> }
<mask>
<mask> return nil, err
<mask> }
<mask>
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove log.Error("querylog: opening qlog reader: %s", err)
return entries, oldest, 0
}
defer func() {
closeErr := r.Close()
if closeErr != nil {
log.Error("querylog: closing file: %s", err)
}
}()
if params.olderThan.IsZero() {
err = r.SeekStart()
} else {
err = r.seekTS(params.olderThan.UnixNano())
if err == nil {
// Read to the next record, because we only need the one that goes
// after it.
_, err = r.ReadNext()
}
</s> add return nil, fmt.Errorf("opening qlog reader: %s", err) </s> remove return entries, oldest, 0
</s> add return nil, nil </s> remove log.Debug("querylog: cannot seek to %s: %s", params.olderThan, err)
</s> add defer func() { err = errors.WithDeferred(err, r.Close()) }()
log.Debug("querylog: cannot seek to %s: %s", olderThan, err) </s> remove return errors.List("error while closing QLogReader", errs...)
</s> add return errors.List("error while closing qLogReader", errs...) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogreader.go |
return &qLogReader{qFiles: qFiles, currentFile: len(qFiles) - 1}, nil | <mask>
<mask> qFiles = append(qFiles, q)
<mask> }
<mask>
<mask> return &QLogReader{
<mask> qFiles: qFiles,
<mask> currentFile: (len(qFiles) - 1),
<mask> }, nil
<mask> }
<mask>
<mask> // seekTS performs binary search of a query log record with the specified
<mask> // timestamp. If the record is found, it sets QLogReader's position to point to
<mask> // that line, so that the next ReadNext call returned this line.
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove // timestamp. If the record is found, it sets QLogReader's position to point to
// that line, so that the next ReadNext call returned this line.
func (r *QLogReader) seekTS(timestamp int64) (err error) {
</s> add // timestamp. If the record is found, it sets qLogReader's position to point
// to that line, so that the next ReadNext call returned this line.
func (r *qLogReader) seekTS(timestamp int64) (err error) { </s> remove // with the specified timestamp. Once the record is found, it sets
// "position" so that the next ReadNext call returned that record.
</s> add // with the specified timestamp. Once the record is found, it sets "position"
// so that the next ReadNext call returned that record. </s> remove return &QLogFile{
file: f,
}, nil
</s> add return &qLogFile{file: f}, nil
}
// validateQLogLineIdx returns error if the line index is not valid to continue
// search.
func (q *qLogFile) validateQLogLineIdx(lineIdx, lastProbeLineIdx, ts, fSize int64) (err error) {
if lineIdx == lastProbeLineIdx {
if lineIdx == 0 {
return errTSTooEarly
}
// If we're testing the same line twice then most likely the scope is
// too narrow and we won't find anything anymore in any other file.
return fmt.Errorf("looking up timestamp %d in %q: %w", ts, q.file.Name(), errTSNotFound)
} else if lineIdx == fSize {
return errTSTooLate
}
return nil </s> remove // 1. It starts with the position in the middle of a file
// 2. Shifts back to the beginning of the line
// 3. Checks the log record timestamp
// 4. If it is lower than the timestamp we are looking for,
// it shifts seek position to 3/4 of the file. Otherwise, to 1/4 of the file.
// 5. It performs the search again, every time the search scope is narrowed twice.
</s> add // 1. It starts with the position in the middle of a file.
// 2. Shifts back to the beginning of the line.
// 3. Checks the log record timestamp.
// 4. If it is lower than the timestamp we are looking for, it shifts seek
// position to 3/4 of the file. Otherwise, to 1/4 of the file.
// 5. It performs the search again, every time the search scope is narrowed
// twice. </s> remove // Please note that this is a stateful object.
// Internally, it contains a pointer to a particular query log file, and
// to a specific position in this file, and it reads lines in reverse order
// starting from that position.
type QLogReader struct {
// qFiles - array with the query log files
// The order is - from oldest to newest
qFiles []*QLogFile
currentFile int // Index of the current file
</s> add // Please note that this is a stateful object. Internally, it contains a
// pointer to a particular query log file, and to a specific position in this
// file, and it reads lines in reverse order starting from that position.
type qLogReader struct {
// qFiles is an array with the query log files. The order is from oldest
// to newest.
qFiles []*qLogFile
// currentFile is the index of the current file.
currentFile int | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogreader.go |
// timestamp. If the record is found, it sets qLogReader's position to point
// to that line, so that the next ReadNext call returned this line.
func (r *qLogReader) seekTS(timestamp int64) (err error) { | <mask> }, nil
<mask> }
<mask>
<mask> // seekTS performs binary search of a query log record with the specified
<mask> // timestamp. If the record is found, it sets QLogReader's position to point to
<mask> // that line, so that the next ReadNext call returned this line.
<mask> func (r *QLogReader) seekTS(timestamp int64) (err error) {
<mask> for i := len(r.qFiles) - 1; i >= 0; i-- {
<mask> q := r.qFiles[i]
<mask> _, _, err = q.seekTS(timestamp)
<mask> if err != nil {
<mask> if errors.Is(err, ErrTSTooEarly) {
</s> Pull request: querylog imp code
Merge in DNS/adguard-home from querylog-imp-code to master
Squashed commit of the following:
commit a58ad36508a2355b686d314dec51ac0b5e357281
Merge: df5494f2c 941eb1dd7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:26:55 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit df5494f2c337736690a3c2a547c2d71858d0378f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 15:24:43 2023 +0300
querylog: imp code
commit 8c3c2b76dd5858e7b107f222c112e9cde2477fb3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:14:15 2023 +0300
all: lint script
commit be04a4decfaf20a1649d32ecaab3c1c6bb205ffd
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 12:03:12 2023 +0300
querylog: imp code
commit fe7beacff3a5cfcf2332c4998b9c65820284eaf7
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:57:33 2023 +0300
querylog: imp docs
commit 2ae239c57d12524fbc092f582842af2ad726c1d0
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:46:54 2023 +0300
querylog: imp code
commit 417216cefbf154fa870f8f43468f35e0e345971f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:25:44 2023 +0300
querylog: imp code
commit 514b6ee99113844a4e0dad30dc53703e3220c289
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed May 24 11:14:13 2023 +0300
querylog: imp docs
commit 321351a3abb524208daacd5a3a7fbf5f07ab259d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:38:31 2023 +0300
querylog: imp code
commit ee91de5c43210b5bc213f933d411adb894d2e586
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 16:01:32 2023 +0300
querylog: imp code
commit 862ff12177fb769d5cb2ec250eaee538dc91d70a
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 15:07:24 2023 +0300
querylog: imp code
commit cc62c1c4ae8b813d03ccf51b596ba1ebf44d9a1f
Merge: 37ace34e9 24b41100c
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 13:09:10 2023 +0300
Merge remote-tracking branch 'origin/master' into querylog-imp-code
commit 37ace34e91e5189bef6e774db960f40cdaa18270
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:23:08 2023 +0300
querylog: imp code
commit 8417815a6349f10b5dbad410ce28aab98bc479fa
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Mon May 22 11:08:29 2023 +0300
querylog: imp docs
commit 4e5cde74d25713f78675aa3e18083b4fb5e619f3
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:41:34 2023 +0300
querylog: imp code
commit 3494eab7006240f652a0217d305ac916bd6c3c83
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:13:08 2023 +0300
all: lint script
commit 704534ce6278e7d9b1bef30a3acc4e59f25693bc
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 16:12:04 2023 +0300
querylog: imp code
commit 48510102a2fa5187f78067d2b9157dac62f8bb56
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:52:57 2023 +0300
querylog: imp code
commit 89c273aea0e6758eb749a2d3bbaf1bc385a57797
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 15:40:50 2023 +0300
querylog: imp code
commit 0057fe64553ad38de0fda10efb9d3512c9a00e45
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Fri May 19 13:54:46 2023 +0300
querylog: imp code
... and 1 more commit </s> remove return &QLogReader{
qFiles: qFiles,
currentFile: (len(qFiles) - 1),
}, nil
</s> add return &qLogReader{qFiles: qFiles, currentFile: len(qFiles) - 1}, nil </s> remove if errors.Is(err, ErrTSTooEarly) {
</s> add if errors.Is(err, errTSTooEarly) { </s> remove // with the specified timestamp. Once the record is found, it sets
// "position" so that the next ReadNext call returned that record.
</s> add // with the specified timestamp. Once the record is found, it sets "position"
// so that the next ReadNext call returned that record. </s> remove return &QLogFile{
file: f,
}, nil
</s> add return &qLogFile{file: f}, nil
}
// validateQLogLineIdx returns error if the line index is not valid to continue
// search.
func (q *qLogFile) validateQLogLineIdx(lineIdx, lastProbeLineIdx, ts, fSize int64) (err error) {
if lineIdx == lastProbeLineIdx {
if lineIdx == 0 {
return errTSTooEarly
}
// If we're testing the same line twice then most likely the scope is
// too narrow and we won't find anything anymore in any other file.
return fmt.Errorf("looking up timestamp %d in %q: %w", ts, q.file.Name(), errTSNotFound)
} else if lineIdx == fSize {
return errTSTooLate
}
return nil </s> remove // 1. It starts with the position in the middle of a file
// 2. Shifts back to the beginning of the line
// 3. Checks the log record timestamp
// 4. If it is lower than the timestamp we are looking for,
// it shifts seek position to 3/4 of the file. Otherwise, to 1/4 of the file.
// 5. It performs the search again, every time the search scope is narrowed twice.
</s> add // 1. It starts with the position in the middle of a file.
// 2. Shifts back to the beginning of the line.
// 3. Checks the log record timestamp.
// 4. If it is lower than the timestamp we are looking for, it shifts seek
// position to 3/4 of the file. Otherwise, to 1/4 of the file.
// 5. It performs the search again, every time the search scope is narrowed
// twice. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/cbc7985e756e40ec6ee290c003ff343f825a89b2 | internal/querylog/qlogreader.go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.