diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-03-13 22:07:39 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-03-13 22:07:39 -0800 |
| commit | 6d3a96eb562f13336fac7e52ccee905fd696c426 (patch) | |
| tree | 10c5a0c76d37d340183d654624cea44638cf2cb2 /weed/filer/abstract_sql | |
| parent | cb423312a424d60836f51a0d0c8608bb71dc7ee7 (diff) | |
| download | seaweedfs-6d3a96eb562f13336fac7e52ccee905fd696c426.tar.xz seaweedfs-6d3a96eb562f13336fac7e52ccee905fd696c426.zip | |
filer: mysql2, postgres2 trigger actions on bucket creation and deletion
fix https://github.com/chrislusf/seaweedfs/issues/1877
Diffstat (limited to 'weed/filer/abstract_sql')
| -rw-r--r-- | weed/filer/abstract_sql/abstract_sql_store.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/weed/filer/abstract_sql/abstract_sql_store.go b/weed/filer/abstract_sql/abstract_sql_store.go index 07ce56145..6f37a118b 100644 --- a/weed/filer/abstract_sql/abstract_sql_store.go +++ b/weed/filer/abstract_sql/abstract_sql_store.go @@ -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" ) |
