filer: mysql2, postgres2 trigger actions on bucket creation and deletion

fix https://github.com/chrislusf/seaweedfs/issues/1877
This commit is contained in:
Chris Lu
2021-03-13 22:07:39 -08:00
parent cb423312a4
commit 6d3a96eb56
4 changed files with 66 additions and 0 deletions

View File

@@ -32,6 +32,25 @@ type AbstractSqlStore struct {
dbsLock sync.Mutex
}
func (store *AbstractSqlStore) OnBucketCreation(bucket string) {
store.dbsLock.Lock()
defer store.dbsLock.Unlock()
if store.dbs == nil {
return
}
store.dbs[bucket] = true
}
func (store *AbstractSqlStore) OnBucketDeletion(bucket string) {
store.dbsLock.Lock()
defer store.dbsLock.Unlock()
if store.dbs == nil {
return
}
delete(store.dbs, bucket)
}
const (
DEFAULT_TABLE = "filemeta"
)