mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-30 09:52:25 -05:00
[feature] Clean up/uncache remote media (#407)
* Add whereNotEmptyAndNotNull * Add GetRemoteOlderThanDays * Add GetRemoteOlderThanDays * Add PruneRemote to Manager interface * Start implementing PruneRemote * add new attachment + status to tests * fix up and test GetRemoteOlderThan * fix bad import * PruneRemote: return number pruned * add Cached column to mediaattachment * update + test pruneRemote * update mediaTest * use Cached column * upstep bun to latest version * embed structs in mediaAttachment * migrate mediaAttachment to new format * don't default cached to true * select only remote media * update db dependencies * step bun back to last working version * update pruneRemote to use Cached field * fix storage path of test attachments * add recache logic to manager * fix trimmed aspect ratio * test prune and recache * return errwithcode * tidy up different paths for emoji vs attachment * fix incorrect thumbnail type being stored * expose TransportController to media processor * implement tee-ing recached content * add thoughts of dog to test fedi attachments * test get remote files * add comment on PruneRemote * add postData cleanup to recache * test thumbnail fetching * add incredible diagram * go mod tidy * buffer pipes for recache streaming * test for client stops reading after 1kb * add media-remote-cache-days to config * add cron package * wrap logrus so it's available to cron * start and stop cron jobs gracefully
This commit is contained in:
parent
100f1280a6
commit
07727753b9
424 changed files with 637100 additions and 176498 deletions
71
vendor/modernc.org/libc/libc_netbsd.go
generated
vendored
71
vendor/modernc.org/libc/libc_netbsd.go
generated
vendored
|
|
@ -16,6 +16,7 @@ import (
|
|||
gotime "time"
|
||||
"unsafe"
|
||||
|
||||
guuid "github.com/google/uuid"
|
||||
"golang.org/x/sys/unix"
|
||||
"modernc.org/libc/errno"
|
||||
"modernc.org/libc/fcntl"
|
||||
|
|
@ -32,6 +33,7 @@ import (
|
|||
"modernc.org/libc/termios"
|
||||
"modernc.org/libc/time"
|
||||
"modernc.org/libc/unistd"
|
||||
"modernc.org/libc/uuid"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -751,47 +753,6 @@ func Xfileno(t *TLS, stream uintptr) int32 {
|
|||
panic(todo(""))
|
||||
}
|
||||
|
||||
// int mkstemps(char *template, int suffixlen);
|
||||
func Xmkstemps(t *TLS, template uintptr, suffixlen int32) int32 {
|
||||
return Xmkstemps64(t, template, suffixlen)
|
||||
}
|
||||
|
||||
// int mkstemps(char *template, int suffixlen);
|
||||
func Xmkstemps64(t *TLS, template uintptr, suffixlen int32) int32 {
|
||||
len := uintptr(Xstrlen(t, template))
|
||||
x := template + uintptr(len-6) - uintptr(suffixlen)
|
||||
for i := uintptr(0); i < 6; i++ {
|
||||
if *(*byte)(unsafe.Pointer(x + i)) != 'X' {
|
||||
if dmesgs {
|
||||
dmesg("%v: FAIL", origin(1))
|
||||
}
|
||||
t.setErrno(errno.EINVAL)
|
||||
return -1
|
||||
}
|
||||
}
|
||||
|
||||
fd, err := tempFile(template, x)
|
||||
if err != nil {
|
||||
if dmesgs {
|
||||
dmesg("%v: %v FAIL", origin(1), err)
|
||||
}
|
||||
t.setErrno(err)
|
||||
return -1
|
||||
}
|
||||
|
||||
return int32(fd)
|
||||
}
|
||||
|
||||
// int mkstemp(char *template);
|
||||
func Xmkstemp(t *TLS, template uintptr) int32 {
|
||||
return Xmkstemp64(t, template)
|
||||
}
|
||||
|
||||
// int mkstemp(char *template);
|
||||
func Xmkstemp64(t *TLS, template uintptr) int32 {
|
||||
return Xmkstemps64(t, template, 0)
|
||||
}
|
||||
|
||||
func newFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscall.Errno) (r *fts.FTSENT) {
|
||||
var statp uintptr
|
||||
if stat != nil {
|
||||
|
|
@ -1391,11 +1352,6 @@ func Xwritev(t *TLS, fd int32, iov uintptr, iovcnt int32) types.Ssize_t {
|
|||
panic(todo(""))
|
||||
}
|
||||
|
||||
// void endpwent(void);
|
||||
func Xendpwent(t *TLS) {
|
||||
// nop
|
||||
}
|
||||
|
||||
// int __isoc99_sscanf(const char *str, const char *format, ...);
|
||||
func X__isoc99_sscanf(t *TLS, str, format, va uintptr) int32 {
|
||||
r := Xsscanf(t, str, format, va)
|
||||
|
|
@ -1405,18 +1361,6 @@ func X__isoc99_sscanf(t *TLS, str, format, va uintptr) int32 {
|
|||
return r
|
||||
}
|
||||
|
||||
var ctimeStaticBuf [32]byte
|
||||
|
||||
// char *ctime(const time_t *timep);
|
||||
func Xctime(t *TLS, timep uintptr) uintptr {
|
||||
return Xctime_r(t, timep, uintptr(unsafe.Pointer(&ctimeStaticBuf[0])))
|
||||
}
|
||||
|
||||
// char *ctime_r(const time_t *timep, char *buf);
|
||||
func Xctime_r(t *TLS, timep, buf uintptr) uintptr {
|
||||
panic(todo(""))
|
||||
}
|
||||
|
||||
// void __assert(const char * func, const char * file, int line, const char *expr) __dead2;
|
||||
func X__assert(t *TLS, fn, file uintptr, line int32, expr uintptr) {
|
||||
X__assert_fail(t, expr, file, uint32(line), fn)
|
||||
|
|
@ -1637,3 +1581,14 @@ func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pth
|
|||
(*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr = (((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & Uint32FromInt32(CplInt32(3))) | uint32(type1))
|
||||
return 0
|
||||
}
|
||||
|
||||
// int uuid_parse( char *in, uuid_t uu);
|
||||
func Xuuid_parse(t *TLS, in uintptr, uu uintptr) int32 {
|
||||
r, err := guuid.Parse(GoString(in))
|
||||
if err != nil {
|
||||
return -1
|
||||
}
|
||||
|
||||
copy((*RawMem)(unsafe.Pointer(uu))[:unsafe.Sizeof(uuid.Uuid_t{})], r[:])
|
||||
return 0
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue